Auditioner: fix stuck notes when auditioning different files

The MIDI Buffer is cleared when starting to process,
the panic message never made it to the plugin.
This commit is contained in:
Robin Gareus 2023-10-31 02:17:05 +01:00
parent 560885b7da
commit eebc902564
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -285,16 +285,16 @@ Auditioner::roll (pframes_t nframes, samplepos_t start_sample, samplepos_t end_s
BufferSet& bufs = _session.get_route_buffers (n_process_buffers());
if (_queue_panic) {
MidiBuffer& mbuf (bufs.get_midi (0));
if (_queue_panic && asynth) {
_queue_panic = false;
auto pi = std::dynamic_pointer_cast<PluginInsert> (asynth);
for (uint8_t chn = 0; chn < 0xf; ++chn) {
uint8_t buf[3] = { ((uint8_t) (MIDI_CMD_CONTROL | chn)), ((uint8_t) MIDI_CTL_SUSTAIN), 0 };
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
pi->write_immediate_event (Evoral::MIDI_EVENT, 3, buf);
buf[1] = MIDI_CTL_ALL_NOTES_OFF;
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
pi->write_immediate_event (Evoral::MIDI_EVENT, 3, buf);
buf[1] = MIDI_CTL_RESET_CONTROLLERS;
mbuf.push_back(0, Evoral::MIDI_EVENT, 3, buf);
pi->write_immediate_event (Evoral::MIDI_EVENT, 3, buf);
}
}
@ -477,6 +477,7 @@ Auditioner::audition_region (std::shared_ptr<Region> region, bool loop)
* yet auditioning. So Session::non_realtime_overwrite()
* does call the auditioner's DR.
*/
_queue_panic = true;
set_pending_overwrite (PlaylistModified);
_disk_reader->overwrite_existing_buffers ();
}