diff --git a/sources/Region.cpp b/sources/Region.cpp index ac5c804d..83820d41 100644 --- a/sources/Region.cpp +++ b/sources/Region.cpp @@ -539,12 +539,14 @@ bool sfz::Region::registerCC(int channel, int ccNumber, uint8_t ccValue) noexcep if (!channelRange.containsWithEnd(channel)) return false; - // TODO: we can probably if (ccConditions.getWithDefault(ccNumber).containsWithEnd(ccValue)) ccSwitched.set(ccNumber, true); else ccSwitched.set(ccNumber, false); + if (!isSwitchedOn()) + return false; + if (ccTriggers.contains(ccNumber) && ccTriggers.at(ccNumber).containsWithEnd(ccValue)) return true; else @@ -684,7 +686,7 @@ float sfz::Region::getNoteGain(int noteNumber, uint8_t velocity) noexcept float sfz::Region::getCCGain(const sfz::CCValueArray& ccState) noexcept { float gain { 1.0f }; - + // Crossfades due to CC states for (const auto& valuePair : crossfadeCCInRange) { const auto ccValue = ccState[valuePair.first];