Merge pull request #1113 from paulfd/keyswitch-cc-140

Last keyswitches don't change the midi state
This commit is contained in:
Paul Ferrand 2023-01-02 16:08:28 +01:00 committed by GitHub
commit 18d55a0263
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1262,7 +1262,10 @@ void Synth::hdNoteOn(int delay, int noteNumber, float normalizedVelocity) noexce
ASSERT(noteNumber >= 0);
Impl& impl = *impl_;
ScopedTiming logger { impl.dispatchDuration_, ScopedTiming::Operation::addToDuration };
impl.resources_.getMidiState().noteOnEvent(delay, noteNumber, normalizedVelocity);
if (impl.lastKeyswitchLists_[noteNumber].empty())
impl.resources_.getMidiState().noteOnEvent(delay, noteNumber, normalizedVelocity);
impl.noteOnDispatch(delay, noteNumber, normalizedVelocity);
}
@ -1283,7 +1286,10 @@ void Synth::hdNoteOff(int delay, int noteNumber, float normalizedVelocity) noexc
// way in sfz to specify that a release trigger should NOT use the note-on velocity?
// auto replacedVelocity = (velocity == 0 ? getNoteVelocity(noteNumber) : velocity);
MidiState& midiState = impl.resources_.getMidiState();
midiState.noteOffEvent(delay, noteNumber, normalizedVelocity);
if (impl.lastKeyswitchLists_[noteNumber].empty())
midiState.noteOffEvent(delay, noteNumber, normalizedVelocity);
const auto replacedVelocity = midiState.getNoteVelocity(noteNumber);
for (auto& voice : impl.voiceManager_)