From fc34626e501ed5c64400f222028e34691f67efa2 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 12 Apr 2020 13:35:21 +0200 Subject: [PATCH] Fix loop range changes while playing - #8001 Since ead883302fe800ae, it is no longer possible to use a null pointer SessionEvent::track as flag to indicate overriding all buffers. --- libs/ardour/ardour/session_event.h | 1 + libs/ardour/session.cc | 7 ++++--- libs/ardour/session_butler.cc | 1 + libs/ardour/session_process.cc | 4 ++++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/ardour/ardour/session_event.h b/libs/ardour/ardour/session_event.h index 9eeecb9a56..79acec3bcf 100644 --- a/libs/ardour/ardour/session_event.h +++ b/libs/ardour/ardour/session_event.h @@ -53,6 +53,7 @@ public: RangeStop, RangeLocate, Overwrite, + OverwriteAll, Audition, SetPlayAudioRange, CancelPlayAudioRange, diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 2b0b9c0921..900cd90372 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1549,9 +1549,10 @@ Session::auto_loop_changed (Location* location) } else { - // schedule a buffer overwrite to refill buffers with the new loop. - - request_overwrite_buffer (boost::shared_ptr(), LoopChanged); + /* schedule a buffer overwrite to refill buffers with the new loop. */ + SessionEvent *ev = new SessionEvent (SessionEvent::OverwriteAll, SessionEvent::Add, SessionEvent::Immediate, 0, 0, 0.0); + ev->overwrite = LoopChanged; + queue_event (ev); } } diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc index 143c9d540d..ee8fc08f3b 100644 --- a/libs/ardour/session_butler.cc +++ b/libs/ardour/session_butler.cc @@ -79,6 +79,7 @@ Session::schedule_capture_buffering_adjustment () void Session::request_overwrite_buffer (boost::shared_ptr t, OverwriteReason why) { + assert (t); SessionEvent *ev = new SessionEvent (SessionEvent::Overwrite, SessionEvent::Add, SessionEvent::Immediate, 0, 0, 0.0); ev->set_track (t); ev->overwrite = why; diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index 089aed7c03..f5613d3af4 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -954,6 +954,10 @@ Session::process_event (SessionEvent* ev) } break; + case SessionEvent::OverwriteAll: + overwrite_some_buffers (boost::shared_ptr(), ev->overwrite); + break; + case SessionEvent::Audition: set_audition (ev->region); // drop reference to region