From f0a52eccc0768d2c1045b5f07e5474ec60e0222f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 11 Dec 2025 06:08:29 +0100 Subject: [PATCH] Fix MIDI audition --- libs/ardour/auditioner.cc | 8 +------- libs/ardour/butler.cc | 16 ++++++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/libs/ardour/auditioner.cc b/libs/ardour/auditioner.cc index 95ac573741..1f0e1f1ca5 100644 --- a/libs/ardour/auditioner.cc +++ b/libs/ardour/auditioner.cc @@ -471,15 +471,9 @@ Auditioner::audition_region (std::shared_ptr region, bool loop) _disk_reader->seek (offset.samples(), true); if (_midi_audition) { - /* Fill MIDI buffers. - * This is safe to call from here. ::::audition_region() - * is called by the butler thread. Also the session is not - * yet auditioning. So Session::non_realtime_overwrite() - * does call the auditioner's DR. - */ + /* Request Fill MIDI buffers. */ _queue_panic = true; set_pending_overwrite (PlaylistModified); - _disk_reader->overwrite_existing_buffers (); } current_sample = offset.samples(); diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index c39687d2d7..c1a85ea3b8 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -257,13 +257,17 @@ Butler::thread_work () } } - sampleoffset_t audition_seek; - if (should_run && _session.is_auditioning () && (audition_seek = _session.the_auditioner ()->seek_sample ()) >= 0) { + if (should_run && _session.is_auditioning ()) { std::shared_ptr tr = std::dynamic_pointer_cast (_session.the_auditioner ()); - DEBUG_TRACE (DEBUG::Butler, "seek the auditioner\n"); - tr->seek (audition_seek); - tr->do_refill (); - _session.the_auditioner ()->seek_response (audition_seek); + sampleoffset_t audition_seek; + if ((audition_seek = _session.the_auditioner ()->seek_sample ()) >= 0) { + DEBUG_TRACE (DEBUG::Butler, "seek the auditioner\n"); + tr->seek (audition_seek); + tr->do_refill (); + _session.the_auditioner ()->seek_response (audition_seek); + } else if (tr->pending_overwrite ()) { + tr->overwrite_existing_buffers (); + } } std::shared_ptr rl = _session.get_routes ();