From 7232ac2f671220f7f6a971727b02635b4b387582 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 13 May 2020 18:51:18 -0600 Subject: update DiskReader loop delick objects when loop changes --- libs/ardour/ardour/session.h | 5 +++-- libs/ardour/enums.cc | 1 + libs/ardour/session_butler.cc | 6 +++++- libs/ardour/session_transport.cc | 8 ++++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a54166937e..7de5fea92d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1169,7 +1169,8 @@ public: PostTransportReverse = 0x40, PostTransportClearSubstate = 0x80, PostTransportAdjustPlaybackBuffering = 0x100, - PostTransportAdjustCaptureBuffering = 0x200 + PostTransportAdjustCaptureBuffering = 0x200, + PostTransportLoopChanged = 0x400 }; boost::shared_ptr playlists () const { return _playlists; } @@ -1764,7 +1765,7 @@ private: void non_realtime_set_speed (); void non_realtime_locate (); void non_realtime_stop (bool abort, int entry_request_count, bool& finished); - void non_realtime_overwrite (int entry_request_count, bool& finished); + void non_realtime_overwrite (int entry_request_count, bool& finished, bool reset_loop_declicks); void engine_halted (); void engine_running (); void xrun_recovery (); diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index 3dc0d3122a..9fe3030794 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -482,6 +482,7 @@ setup_enum_writer () REGISTER_CLASS_ENUM (Session, PostTransportClearSubstate); REGISTER_CLASS_ENUM (Session, PostTransportAdjustPlaybackBuffering); REGISTER_CLASS_ENUM (Session, PostTransportAdjustCaptureBuffering); + REGISTER_CLASS_ENUM (Session, PostTransportLoopChanged); REGISTER_BITS (_Session_PostTransportWork); REGISTER_CLASS_ENUM (Session, Clean); diff --git a/libs/ardour/session_butler.cc b/libs/ardour/session_butler.cc index a682eff599..1149cd81c3 100644 --- a/libs/ardour/session_butler.cc +++ b/libs/ardour/session_butler.cc @@ -111,7 +111,11 @@ Session::overwrite_some_buffers (boost::shared_ptr r, OverwriteReason why foreach_track (&Track::set_pending_overwrite, why); } - add_post_transport_work (PostTransportOverWrite); + if (why == LoopChanged) { + add_post_transport_work (PostTransportWork (PostTransportOverWrite|PostTransportLoopChanged)); + } else { + add_post_transport_work (PostTransportOverWrite); + } _butler->schedule_transport_work (); } diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 2f3c2e44f3..a5e8f3ea7f 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -1183,7 +1183,7 @@ Session::butler_transport_work () } if (ptw & PostTransportOverWrite) { - non_realtime_overwrite (on_entry, finished); + non_realtime_overwrite (on_entry, finished, (ptw & PostTransportLoopChanged)); if (!finished) { g_atomic_int_dec_and_test (&_butler->should_do_transport_work); goto restart; @@ -1200,8 +1200,12 @@ Session::butler_transport_work () } void -Session::non_realtime_overwrite (int on_entry, bool& finished) +Session::non_realtime_overwrite (int on_entry, bool& finished, bool update_loop_declicks) { + if (update_loop_declicks) { + DiskReader::reset_loop_declick (_locations->auto_loop_location(), sample_rate()); + } + boost::shared_ptr rl = routes.reader(); for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { boost::shared_ptr tr = boost::dynamic_pointer_cast (*i); -- cgit v1.2.3