Translate the channel for noteOn at the right place

This commit is contained in:
Paul Ferrand 2019-12-15 02:20:58 +01:00
parent 1fe8932851
commit a70316c24c

View file

@ -420,6 +420,7 @@ void sfz::Synth::noteOff(int delay, int channel, int noteNumber, uint8_t velocit
ASSERT(noteNumber < 128); ASSERT(noteNumber < 128);
ASSERT(noteNumber >= 0); ASSERT(noteNumber >= 0);
channel = translateMidiChannelToSfz(channel);
AtomicGuard callbackGuard { inCallback }; AtomicGuard callbackGuard { inCallback };
if (!canEnterCallback) if (!canEnterCallback)
return; return;
@ -430,7 +431,6 @@ void sfz::Synth::noteOff(int delay, int channel, int noteNumber, uint8_t velocit
auto replacedVelocity = midiState.getNoteVelocity(channel, noteNumber); auto replacedVelocity = midiState.getNoteVelocity(channel, noteNumber);
auto randValue = randNoteDistribution(Random::randomGenerator); auto randValue = randNoteDistribution(Random::randomGenerator);
channel = translateMidiChannelToSfz(channel);
for (auto& voice : voices) for (auto& voice : voices)
voice->registerNoteOff(delay, channel, noteNumber, replacedVelocity); voice->registerNoteOff(delay, channel, noteNumber, replacedVelocity);