diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 174a72595d..d142aa9dff 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -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 (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, 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 (); }