From b0e33d7d657063da7207a640836da7dcda349d44 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 11 Jul 2021 02:29:21 +0200 Subject: [PATCH] Fix Loop recording DiskWriter::seek() flushes all recorded audio/MIDI, and resets buffers as if no recording has happened. Data must be flushed to disk before any non-realtime locates happen. This happens at transport-stop, which is usually called first. Except since 8b048bb3515 Session::butler_transport_work() may call non_realtime_stop() after a non_realtime_locate() when looping more than once. --- libs/ardour/session_transport.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 82467c5003..52d2511510 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1142,14 +1142,6 @@ Session::butler_transport_work (bool have_process_lock) } } - const int butler = g_atomic_int_get (&_butler_seek_counter); - const int rtlocates = g_atomic_int_get (&_seek_counter); - - if (butler != rtlocates) { - DEBUG_TRACE (DEBUG::Transport, string_compose ("nonrealtime locate invoked from BTW (butler has done %1, rtlocs %2)\n", butler, rtlocates)); - non_realtime_locate (); - } - if (ptw & PostTransportStop) { non_realtime_stop (ptw & PostTransportAbort, on_entry, finished); if (!finished) { @@ -1158,6 +1150,14 @@ Session::butler_transport_work (bool have_process_lock) } } + const int butler = g_atomic_int_get (&_butler_seek_counter); + const int rtlocates = g_atomic_int_get (&_seek_counter); + + if (butler != rtlocates) { + DEBUG_TRACE (DEBUG::Transport, string_compose ("nonrealtime locate invoked from BTW (butler has done %1, rtlocs %2)\n", butler, rtlocates)); + non_realtime_locate (); + } + if (ptw & PostTransportOverWrite) { non_realtime_overwrite (on_entry, finished, (ptw & PostTransportLoopChanged)); if (!finished) {