Check the triggering channel for CCs and bends

This commit is contained in:
Paul Ferrand 2019-12-17 21:26:04 +01:00
parent 393984e3f3
commit 3f02f46213

View file

@ -157,11 +157,17 @@ void sfz::Voice::registerNoteOff(int delay, int channel, int noteNumber, uint8_t
} }
} }
void sfz::Voice::registerCC(int delay, int channel [[maybe_unused]], int ccNumber, uint8_t ccValue) noexcept void sfz::Voice::registerCC(int delay, int channel, int ccNumber, uint8_t ccValue) noexcept
{ {
if (region == nullptr) if (region == nullptr)
return; return;
if (state == State::idle)
return;
if (triggerChannel != channel)
return;
if (region->checkSustain && noteIsOff && ccNumber == config::sustainCC && ccValue < config::halfCCThreshold) if (region->checkSustain && noteIsOff && ccNumber == config::sustainCC && ccValue < config::halfCCThreshold)
release(delay); release(delay);
@ -199,6 +205,9 @@ void sfz::Voice::registerPitchWheel(int delay, int channel, int pitch) noexcept
if (state == State::idle) if (state == State::idle)
return; return;
if (triggerChannel != channel)
return;
pitchBendEnvelope.registerEvent(delay, pitch); pitchBendEnvelope.registerEvent(delay, pitch);
} }