Removed the constant CC switch check

This commit is contained in:
paulfd 2019-08-30 00:18:59 +02:00
parent dd3c749e8d
commit 0147546f6a
2 changed files with 3 additions and 11 deletions

View file

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

View file

@ -135,7 +135,6 @@ private:
bool bpmSwitched { true };
bool aftertouchSwitched { true };
std::bitset<128> ccSwitched;
bool allCCSwitched { true };
int activeNotesInRange { -1 };
int sequenceCounter { 0 };