From 38ada285f063c43ac940639a8fdbf88193fa9cf4 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 15 Apr 2021 21:43:57 +0200 Subject: [PATCH 1/5] Change note velocity, CC value, and aftertouch arguments to int --- src/sfizz.h | 10 +++++----- src/sfizz.hpp | 10 +++++----- src/sfizz/Synth.cpp | 10 +++++----- src/sfizz/Synth.h | 10 +++++----- src/sfizz/sfizz.cpp | 10 +++++----- src/sfizz/sfizz_wrapper.cpp | 10 +++++----- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/sfizz.h b/src/sfizz.h index 933ca722..50202255 100644 --- a/src/sfizz.h +++ b/src/sfizz.h @@ -339,7 +339,7 @@ SFIZZ_EXPORTED_API void sfizz_set_sample_rate(sfizz_synth_t* synth, float sample * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int note_number, char velocity); +SFIZZ_EXPORTED_API void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int note_number, int velocity); /** * @brief Send a high-precision on event to the synth. @@ -378,7 +378,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_note_on(sfizz_synth_t* synth, int delay, i * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int note_number, char velocity); +SFIZZ_EXPORTED_API void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int note_number, int velocity); /** * @brief Send a high-precision note off event to the synth. @@ -417,7 +417,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_note_off(sfizz_synth_t* synth, int delay, * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_number, char cc_value); +SFIZZ_EXPORTED_API void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_number, int cc_value); /** * @brief Send a high precision CC event to the synth. @@ -508,7 +508,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_pitch_wheel(sfizz_synth_t* synth, int dela * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_aftertouch(sfizz_synth_t* synth, int delay, char aftertouch); +SFIZZ_EXPORTED_API void sfizz_send_aftertouch(sfizz_synth_t* synth, int delay, int aftertouch); /** * @brief Send a high-precision aftertouch event. @@ -546,7 +546,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_aftertouch(sfizz_synth_t* synth, int delay * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_poly_aftertouch(sfizz_synth_t* synth, int delay, int note_number, char aftertouch); +SFIZZ_EXPORTED_API void sfizz_send_poly_aftertouch(sfizz_synth_t* synth, int delay, int note_number, int aftertouch); /** * @brief Send a high-precision polyphonic aftertouch event. diff --git a/src/sfizz.hpp b/src/sfizz.hpp index d17ad902..b96c9555 100644 --- a/src/sfizz.hpp +++ b/src/sfizz.hpp @@ -381,7 +381,7 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void noteOn(int delay, int noteNumber, uint8_t velocity) noexcept; + void noteOn(int delay, int noteNumber, int velocity) noexcept; /** * @brief Send a high-precision note on event to the synth. @@ -417,7 +417,7 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void noteOff(int delay, int noteNumber, uint8_t velocity) noexcept; + void noteOff(int delay, int noteNumber, int velocity) noexcept; /** * @brief Send a note off event to the synth. @@ -453,7 +453,7 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void cc(int delay, int ccNumber, uint8_t ccValue) noexcept; + void cc(int delay, int ccNumber, int ccValue) noexcept; /** * @brief Send a high precision CC event to the synth @@ -547,7 +547,7 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void aftertouch(int delay, uint8_t aftertouch) noexcept; + void aftertouch(int delay, int aftertouch) noexcept; /** * @brief Send a high-precision aftertouch event to the synth. @@ -585,7 +585,7 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void polyAftertouch(int delay, int noteNumber, uint8_t aftertouch) noexcept; + void polyAftertouch(int delay, int noteNumber, int aftertouch) noexcept; /** * @brief Send a high-precision polyphonic aftertouch event to the synth. diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 684662ca..9bdeb4a8 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -1061,7 +1061,7 @@ void Synth::renderBlock(AudioSpan buffer) noexcept SFIZZ_CHECK(isReasonableAudio(buffer.getConstSpan(1))); } -void Synth::noteOn(int delay, int noteNumber, uint8_t velocity) noexcept +void Synth::noteOn(int delay, int noteNumber, int velocity) noexcept { const float normalizedVelocity = normalizeVelocity(velocity); hdNoteOn(delay, noteNumber, normalizedVelocity); @@ -1077,7 +1077,7 @@ void Synth::hdNoteOn(int delay, int noteNumber, float normalizedVelocity) noexce impl.resources_.midiState.noteOnEvent(delay, noteNumber, normalizedVelocity); } -void Synth::noteOff(int delay, int noteNumber, uint8_t velocity) noexcept +void Synth::noteOff(int delay, int noteNumber, int velocity) noexcept { const float normalizedVelocity = normalizeVelocity(velocity); hdNoteOff(delay, noteNumber, normalizedVelocity); @@ -1221,7 +1221,7 @@ void Synth::Impl::startDelayedSostenutoReleases(Layer* layer, int delay, SisterV layer->delayedSostenutoReleases_.clear(); } -void Synth::cc(int delay, int ccNumber, uint8_t ccValue) noexcept +void Synth::cc(int delay, int ccNumber, int ccValue) noexcept { const auto normalizedCC = normalizeCC(ccValue); hdcc(delay, ccNumber, normalizedCC); @@ -1345,7 +1345,7 @@ void Synth::hdPitchWheel(int delay, float normalizedPitch) noexcept impl.performHdcc(delay, ExtendedCCs::pitchBend, normalizedPitch, false); } -void Synth::aftertouch(int delay, uint8_t aftertouch) noexcept +void Synth::aftertouch(int delay, int aftertouch) noexcept { const float normalizedAftertouch = normalize7Bits(aftertouch); hdAftertouch(delay, normalizedAftertouch); @@ -1369,7 +1369,7 @@ void Synth::hdAftertouch(int delay, float normAftertouch) noexcept impl.performHdcc(delay, ExtendedCCs::channelAftertouch, normAftertouch, false); } -void Synth::polyAftertouch(int delay, int noteNumber, uint8_t aftertouch) noexcept +void Synth::polyAftertouch(int delay, int noteNumber, int aftertouch) noexcept { const float normalizedAftertouch = normalize7Bits(aftertouch); hdPolyAftertouch(delay, noteNumber, normalizedAftertouch); diff --git a/src/sfizz/Synth.h b/src/sfizz/Synth.h index d44e3812..2c97effe 100644 --- a/src/sfizz/Synth.h +++ b/src/sfizz/Synth.h @@ -352,7 +352,7 @@ public: * @param noteNumber the midi note number * @param velocity the midi note velocity */ - void noteOn(int delay, int noteNumber, uint8_t velocity) noexcept; + void noteOn(int delay, int noteNumber, int velocity) noexcept; /** * @brief Send a high-precision note on event to the synth * @@ -370,7 +370,7 @@ public: * @param noteNumber the midi note number * @param velocity the midi note velocity */ - void noteOff(int delay, int noteNumber, uint8_t velocity) noexcept; + void noteOff(int delay, int noteNumber, int velocity) noexcept; /** * @brief Send a high-precision note off event to the synth * @@ -388,7 +388,7 @@ public: * @param ccNumber the cc number * @param ccValue the cc value */ - void cc(int delay, int ccNumber, uint8_t ccValue) noexcept; + void cc(int delay, int ccNumber, int ccValue) noexcept; /** * @brief Send a high precision CC event to the synth * @@ -446,7 +446,7 @@ public: * the block in the next call to renderBlock(). * @param aftertouch the aftertouch value */ - void aftertouch(int delay, uint8_t aftertouch) noexcept; + void aftertouch(int delay, int aftertouch) noexcept; /** * @brief Send a high precision aftertouch event to the synth * @@ -471,7 +471,7 @@ public: * @param noteNumber * @param normAftertouch */ - void polyAftertouch(int delay, int noteNumber, uint8_t aftertouch) noexcept; + void polyAftertouch(int delay, int noteNumber, int aftertouch) noexcept; /** * @brief Send a polyphonic aftertouch event to the synth * diff --git a/src/sfizz/sfizz.cpp b/src/sfizz/sfizz.cpp index 62f9bb3a..29f9303a 100644 --- a/src/sfizz/sfizz.cpp +++ b/src/sfizz/sfizz.cpp @@ -160,7 +160,7 @@ void sfz::Sfizz::setVolume(float volume) noexcept synth->synth.setVolume(volume); } -void sfz::Sfizz::noteOn(int delay, int noteNumber, uint8_t velocity) noexcept +void sfz::Sfizz::noteOn(int delay, int noteNumber, int velocity) noexcept { synth->synth.noteOn(delay, noteNumber, velocity); } @@ -170,7 +170,7 @@ void sfz::Sfizz::hdNoteOn(int delay, int noteNumber, float velocity) noexcept synth->synth.hdNoteOn(delay, noteNumber, velocity); } -void sfz::Sfizz::noteOff(int delay, int noteNumber, uint8_t velocity) noexcept +void sfz::Sfizz::noteOff(int delay, int noteNumber, int velocity) noexcept { synth->synth.noteOff(delay, noteNumber, velocity); } @@ -180,7 +180,7 @@ void sfz::Sfizz::hdNoteOff(int delay, int noteNumber, float velocity) noexcept synth->synth.hdNoteOff(delay, noteNumber, velocity); } -void sfz::Sfizz::cc(int delay, int ccNumber, uint8_t ccValue) noexcept +void sfz::Sfizz::cc(int delay, int ccNumber, int ccValue) noexcept { synth->synth.cc(delay, ccNumber, ccValue); } @@ -205,7 +205,7 @@ void sfz::Sfizz::hdPitchWheel(int delay, float pitch) noexcept synth->synth.hdPitchWheel(delay, pitch); } -void sfz::Sfizz::aftertouch(int delay, uint8_t aftertouch) noexcept +void sfz::Sfizz::aftertouch(int delay, int aftertouch) noexcept { synth->synth.aftertouch(delay, aftertouch); } @@ -215,7 +215,7 @@ void sfz::Sfizz::hdAftertouch(int delay, float aftertouch) noexcept synth->synth.hdAftertouch(delay, aftertouch); } -void sfz::Sfizz::polyAftertouch(int delay, int noteNumber, uint8_t aftertouch) noexcept +void sfz::Sfizz::polyAftertouch(int delay, int noteNumber, int aftertouch) noexcept { synth->synth.polyAftertouch(delay, noteNumber, aftertouch); } diff --git a/src/sfizz/sfizz_wrapper.cpp b/src/sfizz/sfizz_wrapper.cpp index c431dd5d..76400227 100644 --- a/src/sfizz/sfizz_wrapper.cpp +++ b/src/sfizz/sfizz_wrapper.cpp @@ -114,7 +114,7 @@ void sfizz_set_sample_rate(sfizz_synth_t* synth, float sample_rate) synth->synth.setSampleRate(sample_rate); } -void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int note_number, char velocity) +void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int note_number, int velocity) { synth->synth.noteOn(delay, note_number, velocity); } @@ -122,7 +122,7 @@ void sfizz_send_hd_note_on(sfizz_synth_t* synth, int delay, int note_number, flo { synth->synth.hdNoteOn(delay, note_number, velocity); } -void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int note_number, char velocity) +void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int note_number, int velocity) { synth->synth.noteOff(delay, note_number, velocity); } @@ -130,7 +130,7 @@ void sfizz_send_hd_note_off(sfizz_synth_t* synth, int delay, int note_number, fl { synth->synth.hdNoteOff(delay, note_number, velocity); } -void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_number, char cc_value) +void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_number, int cc_value) { synth->synth.cc(delay, cc_number, cc_value); } @@ -150,7 +150,7 @@ void sfizz_send_hd_pitch_wheel(sfizz_synth_t* synth, int delay, float pitch) { synth->synth.hdPitchWheel(delay, pitch); } -void sfizz_send_aftertouch(sfizz_synth_t* synth, int delay, char aftertouch) +void sfizz_send_aftertouch(sfizz_synth_t* synth, int delay, int aftertouch) { synth->synth.aftertouch(delay, aftertouch); } @@ -158,7 +158,7 @@ void sfizz_send_hd_aftertouch(sfizz_synth_t* synth, int delay, float aftertouch) { synth->synth.hdAftertouch(delay, aftertouch); } -void sfizz_send_poly_aftertouch(sfizz_synth_t* synth, int delay, int note_number, char aftertouch) +void sfizz_send_poly_aftertouch(sfizz_synth_t* synth, int delay, int note_number, int aftertouch) { synth->synth.polyAftertouch(delay, note_number, aftertouch); } From ce1894ccf4e72a4d8e1fea18d0fcdc08a713424d Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 15 Apr 2021 22:14:30 +0200 Subject: [PATCH 2/5] Tempo API in BPM --- plugins/lv2/sfizz.cpp | 2 +- plugins/vst/SfizzVstProcessor.cpp | 4 ++-- src/sfizz.h | 26 +++++++++++++++++++++++++- src/sfizz.hpp | 26 +++++++++++++++++++++++++- src/sfizz/Synth.cpp | 6 ++++++ src/sfizz/Synth.h | 9 +++++++++ src/sfizz/sfizz.cpp | 5 +++++ src/sfizz/sfizz_wrapper.cpp | 4 ++++ 8 files changed, 77 insertions(+), 5 deletions(-) diff --git a/plugins/lv2/sfizz.cpp b/plugins/lv2/sfizz.cpp index e5f35024..d5ec2613 100644 --- a/plugins/lv2/sfizz.cpp +++ b/plugins/lv2/sfizz.cpp @@ -313,7 +313,7 @@ sfizz_lv2_update_timeinfo(sfizz_plugin_t *self, int delay, int updates) if (updates & SFIZZ_TIMEINFO_SIGNATURE) sfizz_send_time_signature(self->synth, delay, self->beats_per_bar, self->beat_unit); if (updates & SFIZZ_TIMEINFO_TEMPO) - sfizz_send_tempo(self->synth, delay, 60.0f / self->bpm_tempo); + sfizz_send_bpm_tempo(self->synth, delay, self->bpm_tempo); if (updates & SFIZZ_TIMEINFO_SPEED) sfizz_send_playback_state(self->synth, delay, self->speed > 0); } diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp index d3b7156f..fb02ab5b 100644 --- a/plugins/vst/SfizzVstProcessor.cpp +++ b/plugins/vst/SfizzVstProcessor.cpp @@ -97,7 +97,7 @@ tresult PLUGIN_API SfizzVstProcessor::initialize(FUnknown* context) _currentStretchedTuning = 0.0; loadSfzFileOrDefault({}, false); - _synth->tempo(0, 0.5); + _synth->bpmTempo(0, 120); _timeSigNumerator = 4; _timeSigDenominator = 4; _synth->timeSignature(0, _timeSigNumerator, _timeSigDenominator); @@ -313,7 +313,7 @@ void SfizzVstProcessor::updateTimeInfo(const Vst::ProcessContext& context) sfz::Sfizz& synth = *_synth; if (context.state & context.kTempoValid) - synth.tempo(0, float(60.0 / context.tempo)); + synth.bpmTempo(0, context.tempo); if (context.state & context.kTimeSigValid) { _timeSigNumerator = context.timeSigNumerator; diff --git a/src/sfizz.h b/src/sfizz.h index 50202255..6ea2b39d 100644 --- a/src/sfizz.h +++ b/src/sfizz.h @@ -43,6 +43,12 @@ #define SFIZZ_EXPORTED_API #endif +#if defined _WIN32 + #define SFIZZ_DEPRECATED_API __declspec(deprecated) +#else + #define SFIZZ_DEPRECATED_API __attribute__ ((deprecated)) +#endif + #ifdef __cplusplus extern "C" { #endif @@ -584,7 +590,25 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_poly_aftertouch(sfizz_synth_t* synth, int * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ -SFIZZ_EXPORTED_API void sfizz_send_tempo(sfizz_synth_t* synth, int delay, float seconds_per_beat); +SFIZZ_EXPORTED_API SFIZZ_DEPRECATED_API void sfizz_send_tempo(sfizz_synth_t* synth, int delay, float seconds_per_beat); + +/** + * @brief Send a tempo event. + * + * This command should be delay-ordered with all other time/signature commands, namely + * tempo(), timeSignature(), timePosition(), and playbackState(), otherwise the behavior + * of the synth is undefined. + * + * @since 0.6.0 + * + * @param synth The synth. + * @param delay The delay. + * @param beats_per_minute The new tempo, in beats per minute. + * + * @par Thread-safety constraints + * - @b RT: the function must be invoked from the Real-time thread + */ +SFIZZ_EXPORTED_API void sfizz_send_bpm_tempo(sfizz_synth_t* synth, int delay, float beats_per_minute); /** * @brief Send the time signature. diff --git a/src/sfizz.hpp b/src/sfizz.hpp index b96c9555..8891dd40 100644 --- a/src/sfizz.hpp +++ b/src/sfizz.hpp @@ -26,6 +26,12 @@ #define SFIZZ_EXPORTED_API #endif +#if defined _WIN32 + #define SFIZZ_DEPRECATED_API __declspec(deprecated) +#else + #define SFIZZ_DEPRECATED_API __attribute__ ((deprecated)) +#endif + struct sfizz_synth_t; namespace sfz @@ -623,7 +629,25 @@ public: * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread */ - void tempo(int delay, float secondsPerBeat) noexcept; + SFIZZ_DEPRECATED_API void tempo(int delay, float secondsPerBeat) noexcept; + + /** + * @brief Send a tempo event to the synth. + * + * This command should be delay-ordered with all other time/signature commands, namely + * tempo(), timeSignature(), timePosition(), and playbackState(), otherwise the behavior + * of the synth is undefined. + * + * @since 0.6.0 + * + * @param delay the delay at which the event occurs; this should be lower + * than the size of the block in the next call to renderBlock(). + * @param beatsPerMinute the new tempo, in beats per minute. + * + * @par Thread-safety constraints + * - @b RT: the function must be invoked from the Real-time thread + */ + void bpmTempo(int delay, float beatsPerMinute) noexcept; /** * @brief Send the time signature. diff --git a/src/sfizz/Synth.cpp b/src/sfizz/Synth.cpp index 9bdeb4a8..1ecba09a 100644 --- a/src/sfizz/Synth.cpp +++ b/src/sfizz/Synth.cpp @@ -1397,6 +1397,12 @@ void Synth::tempo(int delay, float secondsPerBeat) noexcept impl.resources_.beatClock.setTempo(delay, secondsPerBeat); } +void Synth::bpmTempo(int delay, float beatsPerMinute) noexcept +{ + // TODO make this the main tempo function and remove the deprecated other one + return tempo(delay, 60 / beatsPerMinute); +} + void Synth::timeSignature(int delay, int beatsPerBar, int beatUnit) { Impl& impl = *impl_; diff --git a/src/sfizz/Synth.h b/src/sfizz/Synth.h index 2c97effe..1dbb9405 100644 --- a/src/sfizz/Synth.h +++ b/src/sfizz/Synth.h @@ -464,6 +464,15 @@ public: * @param secondsPerQuarter the new period of the quarter note */ void tempo(int delay, float secondsPerQuarter) noexcept; + /** + * @brief Send a tempo event to the synth + * + * @param delay the delay at which the event occurs; this should be lower than the size of + * the block in the next call to renderBlock(), and ordered with respect to + * calls to tempo(), timeSignature(), timePosition(), and playbackState(). + * @param beatsPerMinute the new tempo, in beats per minute + */ + void bpmTempo(int delay, float beatsPerMinute) noexcept; /** * @brief Send a polyphonic aftertouch event to the synth * diff --git a/src/sfizz/sfizz.cpp b/src/sfizz/sfizz.cpp index 29f9303a..e67c3adc 100644 --- a/src/sfizz/sfizz.cpp +++ b/src/sfizz/sfizz.cpp @@ -230,6 +230,11 @@ void sfz::Sfizz::tempo(int delay, float secondsPerBeat) noexcept synth->synth.tempo(delay, secondsPerBeat); } +void sfz::Sfizz::bpmTempo(int delay, float beatsPerMinute) noexcept +{ + synth->synth.bpmTempo(delay, beatsPerMinute); +} + void sfz::Sfizz::timeSignature(int delay, int beatsPerBar, int beatUnit) { synth->synth.timeSignature(delay, beatsPerBar, beatUnit); diff --git a/src/sfizz/sfizz_wrapper.cpp b/src/sfizz/sfizz_wrapper.cpp index 76400227..9f584435 100644 --- a/src/sfizz/sfizz_wrapper.cpp +++ b/src/sfizz/sfizz_wrapper.cpp @@ -170,6 +170,10 @@ void sfizz_send_tempo(sfizz_synth_t* synth, int delay, float seconds_per_quarter { synth->synth.tempo(delay, seconds_per_quarter); } +void sfizz_send_bpm_tempo(sfizz_synth_t* synth, int delay, float beats_per_minute) +{ + synth->synth.bpmTempo(delay, beats_per_minute); +} void sfizz_send_time_signature(sfizz_synth_t* synth, int delay, int beats_per_bar, int beat_unit) { synth->synth.timeSignature(delay, beats_per_bar, beat_unit); From 62506b50f3219995ed279e8852dfa84be5520256 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 15 Apr 2021 22:20:09 +0200 Subject: [PATCH 3/5] Add the missing exportMidnam C++ API --- src/sfizz.hpp | 10 ++++++++++ src/sfizz/sfizz.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/sfizz.hpp b/src/sfizz.hpp index 8891dd40..ee21ea38 100644 --- a/src/sfizz.hpp +++ b/src/sfizz.hpp @@ -954,6 +954,16 @@ public: */ const std::vector>& getCCLabels() const noexcept; + /** + * @brief Export a MIDI Name document describing the currently loaded SFZ file. + * @since 0.6.0 + * + * @param model The model name used if a non-empty string, otherwise generated. + * + * @return A XML string. + */ + std::string exportMidnam(const char* model); + /** * @addtogroup Messaging * @{ diff --git a/src/sfizz/sfizz.cpp b/src/sfizz/sfizz.cpp index e67c3adc..370e5201 100644 --- a/src/sfizz/sfizz.cpp +++ b/src/sfizz/sfizz.cpp @@ -356,6 +356,11 @@ void sfz::Sfizz::clearExternalDefinitions() synth->synth.getParser().clearExternalDefinitions(); } +std::string sfz::Sfizz::exportMidnam(const char* model) +{ + return synth->synth.exportMidnam(model); +} + const std::vector>& sfz::Sfizz::getKeyLabels() const noexcept { return synth->synth.getKeyLabels(); From 34f9754a99a2065f814bd2fd6df77c017c29f3d0 Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 15 Apr 2021 22:21:27 +0200 Subject: [PATCH 4/5] Fix a clang-tidy problem --- plugins/vst/SfizzVstProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/vst/SfizzVstProcessor.cpp b/plugins/vst/SfizzVstProcessor.cpp index fb02ab5b..552d21a7 100644 --- a/plugins/vst/SfizzVstProcessor.cpp +++ b/plugins/vst/SfizzVstProcessor.cpp @@ -313,7 +313,7 @@ void SfizzVstProcessor::updateTimeInfo(const Vst::ProcessContext& context) sfz::Sfizz& synth = *_synth; if (context.state & context.kTempoValid) - synth.bpmTempo(0, context.tempo); + synth.bpmTempo(0, static_cast(context.tempo)); if (context.state & context.kTimeSigValid) { _timeSigNumerator = context.timeSigNumerator; From 416e558c0bd950a8c467661a5d5032d49b4f0eee Mon Sep 17 00:00:00 2001 From: Jean Pierre Cimalando Date: Thu, 15 Apr 2021 22:36:13 +0200 Subject: [PATCH 5/5] Add value constraints in API spec [ci skip] --- src/sfizz.h | 28 ++++++++++++++-------------- src/sfizz.hpp | 28 ++++++++++++++-------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/sfizz.h b/src/sfizz.h index 6ea2b39d..9875f3bf 100644 --- a/src/sfizz.h +++ b/src/sfizz.h @@ -339,8 +339,8 @@ SFIZZ_EXPORTED_API void sfizz_set_sample_rate(sfizz_synth_t* synth, float sample * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param note_number The MIDI note number. - * @param velocity The MIDI velocity. + * @param note_number The MIDI note number, in domain 0 to 127. + * @param velocity The MIDI velocity, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -357,7 +357,7 @@ SFIZZ_EXPORTED_API void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param note_number The MIDI note number. + * @param note_number The MIDI note number, in domain 0 to 127. * @param velocity The normalized MIDI velocity, in domain 0 to 1. * * @par Thread-safety constraints @@ -378,8 +378,8 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_note_on(sfizz_synth_t* synth, int delay, i * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param note_number The MIDI note number. - * @param velocity The MIDI velocity. + * @param note_number The MIDI note number, in domain 0 to 127. + * @param velocity The MIDI velocity, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -399,7 +399,7 @@ SFIZZ_EXPORTED_API void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param note_number The MIDI note number. + * @param note_number The MIDI note number, in domain 0 to 127. * @param velocity The normalized MIDI velocity, in domain 0 to 1. * * @par Thread-safety constraints @@ -417,8 +417,8 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_note_off(sfizz_synth_t* synth, int delay, * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param cc_number The MIDI CC number. - * @param cc_value The MIDI CC value. + * @param cc_number The MIDI CC number, in domain 0 to 127. + * @param cc_value The MIDI CC value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -435,7 +435,7 @@ SFIZZ_EXPORTED_API void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_nu * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param cc_number The MIDI CC number. + * @param cc_number The MIDI CC number, in domain 0 to 127. * @param norm_value The normalized CC value, in domain 0 to 1. * * @par Thread-safety constraints @@ -456,7 +456,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hdcc(sfizz_synth_t* synth, int delay, int cc_ * * @param synth The synth. * @param delay The delay of the event in the block, in samples. - * @param cc_number The MIDI CC number. + * @param cc_number The MIDI CC number, in domain 0 to 127. * @param norm_value The normalized CC value, in domain 0 to 1. * * @par Thread-safety constraints @@ -509,7 +509,7 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_pitch_wheel(sfizz_synth_t* synth, int dela * @param synth The synth. * @param delay The delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param aftertouch The aftertouch value. + * @param aftertouch The aftertouch value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -546,8 +546,8 @@ SFIZZ_EXPORTED_API void sfizz_send_hd_aftertouch(sfizz_synth_t* synth, int delay * @param synth The synth. * @param delay The delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param note_number The note number. - * @param aftertouch The aftertouch value. + * @param note_number The note number, in domain 0 to 127. + * @param aftertouch The aftertouch value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -566,7 +566,7 @@ SFIZZ_EXPORTED_API void sfizz_send_poly_aftertouch(sfizz_synth_t* synth, int del * @param synth The synth. * @param delay The delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param note_number The note number. + * @param note_number The note number, in domain 0 to 127. * @param aftertouch The normalized aftertouch value, in domain 0 to 1. * * @par Thread-safety constraints diff --git a/src/sfizz.hpp b/src/sfizz.hpp index ee21ea38..b519ad92 100644 --- a/src/sfizz.hpp +++ b/src/sfizz.hpp @@ -381,8 +381,8 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the midi note number. - * @param velocity the midi note velocity. + * @param noteNumber the midi note number, in domain 0 to 127. + * @param velocity the midi note velocity, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -399,7 +399,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the midi note number. + * @param noteNumber the midi note number, in domain 0 to 127. * @param velocity the normalized midi note velocity, in domain 0 to 1. * * @par Thread-safety constraints @@ -417,8 +417,8 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the midi note number. - * @param velocity the midi note velocity. + * @param noteNumber the midi note number, in domain 0 to 127. + * @param velocity the midi note velocity, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -435,7 +435,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the midi note number. + * @param noteNumber the midi note number, in domain 0 to 127. * @param velocity the normalized midi note velocity, in domain 0 to 1. * * @par Thread-safety constraints @@ -453,8 +453,8 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param ccNumber the cc number. - * @param ccValue the cc value. + * @param ccNumber the cc number, in domain 0 to 127. + * @param ccValue the cc value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -471,7 +471,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param ccNumber the cc number. + * @param ccNumber the cc number, in domain 0 to 127. * @param normValue the normalized cc value, in domain 0 to 1. * * @par Thread-safety constraints @@ -493,7 +493,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param ccNumber the cc number. + * @param ccNumber the cc number, in domain 0 to 127. * @param normValue the normalized cc value, in domain 0 to 1. * * @par Thread-safety constraints @@ -548,7 +548,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param aftertouch the aftertouch value. + * @param aftertouch the aftertouch value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -585,8 +585,8 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the note number. - * @param aftertouch the aftertouch value. + * @param noteNumber the note number, in domain 0 to 127. + * @param aftertouch the aftertouch value, in domain 0 to 127. * * @par Thread-safety constraints * - @b RT: the function must be invoked from the Real-time thread @@ -605,7 +605,7 @@ public: * * @param delay the delay at which the event occurs; this should be lower * than the size of the block in the next call to renderBlock(). - * @param noteNumber the note number. + * @param noteNumber the note number, in domain 0 to 127. * @param aftertouch the normalized aftertouch value, in domain 0 to 1. * * @par Thread-safety constraints