From 0147546f6a4cd99c3d16343d11f2f808005be81b Mon Sep 17 00:00:00 2001 From: paulfd Date: Fri, 30 Aug 2019 00:18:59 +0200 Subject: [PATCH] Removed the constant CC switch check --- sources/Region.cpp | 13 +++---------- sources/Region.h | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sources/Region.cpp b/sources/Region.cpp index 9f2f9356..ac5c804d 100644 --- a/sources/Region.cpp +++ b/sources/Region.cpp @@ -443,7 +443,7 @@ bool sfz::Region::parseOpcode(const Opcode& opcode) bool sfz::Region::isSwitchedOn() const noexcept { - return keySwitched && previousKeySwitched && sequenceSwitched && pitchSwitched && bpmSwitched && aftertouchSwitched && allCCSwitched; + return keySwitched && previousKeySwitched && sequenceSwitched && pitchSwitched && bpmSwitched && aftertouchSwitched && ccSwitched.all(); } bool sfz::Region::registerNoteOn(int channel, int noteNumber, uint8_t velocity, float randValue) noexcept @@ -539,16 +539,12 @@ 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 (ccSwitched.all()) - allCCSwitched = true; - else - allCCSwitched = false; - if (ccTriggers.contains(ccNumber) && ccTriggers.at(ccNumber).containsWithEnd(ccValue)) return true; else @@ -688,10 +684,7 @@ float sfz::Region::getNoteGain(int noteNumber, uint8_t velocity) noexcept float sfz::Region::getCCGain(const sfz::CCValueArray& ccState) noexcept { float gain { 1.0f }; - - if (amplitudeCC) - gain *= *amplitudeCC - + // Crossfades due to CC states for (const auto& valuePair : crossfadeCCInRange) { const auto ccValue = ccState[valuePair.first]; diff --git a/sources/Region.h b/sources/Region.h index 2f71ee88..d8604067 100644 --- a/sources/Region.h +++ b/sources/Region.h @@ -135,7 +135,6 @@ private: bool bpmSwitched { true }; bool aftertouchSwitched { true }; std::bitset<128> ccSwitched; - bool allCCSwitched { true }; int activeNotesInRange { -1 }; int sequenceCounter { 0 };