mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Postpone clearing old MIDI events until next event
This fixes Native Instrument's FM7 crashing on MIDI input. The plugin expects the last received MIDI event to always be alive during audio processing, even if there have not been any new events in this processing cycle.
This commit is contained in:
@@ -278,7 +278,9 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
|
||||
}},
|
||||
request.buffers);
|
||||
|
||||
next_audio_buffer_midi_events.clear();
|
||||
// See the docstrong on `should_clear_midi_events` for why we
|
||||
// don't just clear `next_buffer_midi_events` here
|
||||
should_clear_midi_events = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -303,6 +305,14 @@ void Vst2Bridge::run() {
|
||||
// plugin.
|
||||
std::lock_guard lock(next_buffer_midi_events_mutex);
|
||||
|
||||
// See the docstring on `should_clear_midi_events` for why we
|
||||
// only deallocate old MIDI events here instead of a at the end
|
||||
// of every processing cycle
|
||||
if (should_clear_midi_events) {
|
||||
next_audio_buffer_midi_events.clear();
|
||||
should_clear_midi_events = false;
|
||||
}
|
||||
|
||||
next_audio_buffer_midi_events.push_back(
|
||||
std::get<DynamicVstEvents>(event.payload));
|
||||
DynamicVstEvents& events = next_audio_buffer_midi_events.back();
|
||||
|
||||
Reference in New Issue
Block a user