Reset voice on soundOff/noteOff CCs

This commit is contained in:
Paul Ferrand 2019-12-17 22:49:16 +01:00
parent 2317c4dd4b
commit b00103d342
2 changed files with 10 additions and 0 deletions

View file

@ -41,6 +41,11 @@ namespace config {
constexpr int numVoices { 64 };
constexpr int maxVoices { 256 };
constexpr int sustainCC { 64 };
constexpr int allSoundOffCC { 120 };
constexpr int resetCC { 121 };
constexpr int allNotesOffCC { 123 };
constexpr int omniOffCC { 124 };
constexpr int omniOnCC { 125 };
constexpr int halfCCThreshold { 64 };
constexpr int centPerSemitone { 100 };
constexpr float virtuallyZero { 0.00005f };

View file

@ -168,6 +168,11 @@ void sfz::Voice::registerCC(int delay, int channel, int ccNumber, uint8_t ccValu
if (triggerChannel != channel)
return;
if (ccNumber == config::allNotesOffCC || ccNumber == config::allSoundOffCC) {
reset();
return;
}
if (region->checkSustain && noteIsOff && ccNumber == config::sustainCC && ccValue < config::halfCCThreshold)
release(delay);