From 18cc80f3449a4ba7be73e7aefb546c4c526cdb3c Mon Sep 17 00:00:00 2001 From: paulfd Date: Fri, 30 Aug 2019 00:21:19 +0200 Subject: [PATCH] Added a switched on check for CC events in the regions --- sources/Region.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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];