From b00103d34233e3dbe0aefa3e58e059adb5ccd550 Mon Sep 17 00:00:00 2001 From: Paul Ferrand Date: Tue, 17 Dec 2019 22:49:16 +0100 Subject: [PATCH] Reset voice on soundOff/noteOff CCs --- src/sfizz/Config.h | 5 +++++ src/sfizz/Voice.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/sfizz/Config.h b/src/sfizz/Config.h index a0995a5d..e741b6d3 100644 --- a/src/sfizz/Config.h +++ b/src/sfizz/Config.h @@ -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 }; diff --git a/src/sfizz/Voice.cpp b/src/sfizz/Voice.cpp index 667b4811..9dd59f1b 100644 --- a/src/sfizz/Voice.cpp +++ b/src/sfizz/Voice.cpp @@ -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);