From 38841eccaf8ac5b10ba5a32013f20f6d2c00cf18 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 11 Jul 2021 02:35:15 +0200 Subject: [PATCH] Remove unused MIDI-flush realtime_stop() calls unset_play_loop(), unless loop is a transport-state. Any later calls by butler_transport_work() will never reach this get_play_loop() clause when just looping. Besides while recording, locates are not possible, so this case never triggered under normal operation (Non-seamless looping is no longer supported since 6.0). --- libs/ardour/ardour/butler.h | 2 -- libs/ardour/butler.cc | 49 -------------------------------- libs/ardour/session_transport.cc | 37 ------------------------ 3 files changed, 88 deletions(-) diff --git a/libs/ardour/ardour/butler.h b/libs/ardour/ardour/butler.h index 41a544f47d..f0fee44345 100644 --- a/libs/ardour/ardour/butler.h +++ b/libs/ardour/ardour/butler.h @@ -66,8 +66,6 @@ class LIBARDOUR_API Butler : public SessionHandleRef samplecnt_t audio_playback_buffer_size() const { return _audio_playback_buffer_size; } uint32_t midi_buffer_size() const { return _midi_buffer_size; } - bool flush_tracks_to_disk_after_locate (boost::shared_ptr, uint32_t& errors); - static void* _thread_work(void *arg); void* thread_work(); diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index 3b7b6128ef..a456bacab9 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -376,55 +376,6 @@ Butler::flush_tracks_to_disk_normal (boost::shared_ptr rl, uint32_t& return disk_work_outstanding; } -bool -Butler::flush_tracks_to_disk_after_locate (boost::shared_ptr rl, uint32_t& errors) -{ - bool disk_work_outstanding = false; - - /* almost the same as the "normal" version except that we do not test - * for transport_work_requested() and we force flushes. - */ - - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - - // cerr << "write behind for " << (*i)->name () << endl; - - boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); - - if (!tr) { - continue; - } - - /* note that we still try to flush diskstreams attached to inactive routes - */ - - int ret; - - DEBUG_TRACE (DEBUG::Butler, string_compose ("butler flushes track %1 capture load %2\n", tr->name(), tr->capture_buffer_load())); - ret = tr->do_flush (ButlerContext, true); - switch (ret) { - case 0: - DEBUG_TRACE (DEBUG::Butler, string_compose ("\tflush complete for %1\n", tr->name())); - break; - - case 1: - DEBUG_TRACE (DEBUG::Butler, string_compose ("\tflush not finished for %1\n", tr->name())); - disk_work_outstanding = true; - break; - - default: - errors++; - error << string_compose(_("Butler write-behind failure on dstream %1"), (*i)->name()) << endmsg; - std::cerr << string_compose(_("Butler write-behind failure on dstream %1"), (*i)->name()) << std::endl; - /* don't break - try to flush all streams in case they - are split across disks. - */ - } - } - - return disk_work_outstanding; -} - void Butler::schedule_transport_work () { diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 52d2511510..3908f3ba76 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1069,43 +1069,6 @@ Session::butler_transport_work (bool have_process_lock) DEBUG_TRACE (DEBUG::Transport, string_compose ("Butler transport work, todo = [%1] (0x%3%4%5) at %2\n", enum_2_string (ptw), (before = g_get_monotonic_time()), std::hex, ptw, std::dec)); - if (ptw & PostTransportLocate) { - - if (get_play_loop()) { - - DEBUG_TRACE (DEBUG::Butler, "flush loop recording fragment to disk\n"); - - /* this locate might be happening while we are - * loop recording. - * - * Non-seamless looping will require a locate (below) that - * will reset capture buffers and throw away data. - * - * Rather than first find all tracks and see if they - * have outstanding data, just do a flush anyway. It - * may be cheaper this way anyway, and is certainly - * more accurate. - */ - - bool more_disk_io_to_do = false; - uint32_t errors = 0; - - do { - more_disk_io_to_do = _butler->flush_tracks_to_disk_after_locate (r, errors); - - if (errors) { - break; - } - - if (more_disk_io_to_do) { - continue; - } - - } while (false); - - } - } - if (ptw & PostTransportAdjustPlaybackBuffering) { /* need to prevent concurrency with ARDOUR::Reader::run(), * DiskWriter::adjust_buffering() re-allocates the ringbuffer */