Added a switched on check for CC events in the regions

This commit is contained in:
paulfd 2019-08-30 00:21:19 +02:00
parent 0147546f6a
commit 18cc80f344

View file

@ -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];