From 84506a041c10ee592e485bc99822f0658f63718c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 9 Aug 2024 16:03:39 +0200 Subject: [PATCH 1/3] Move Mute automation with region(s) #9762 Mute and Panner are the only automatable Route owned controls (that are not managed by a processor). So they need special casing to be moved when moving a region. --- libs/ardour/disk_reader.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 55374b5175..d812648759 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -1375,7 +1375,7 @@ DiskReader::playlist_ranges_moved (list const& movements, b return; } - /* move panner automation */ + /* move panner automation (route owned control) */ std::shared_ptr pannable = _track.pannable (); Evoral::ControlSet::Controls& c (pannable->controls ()); @@ -1395,6 +1395,18 @@ DiskReader::playlist_ranges_moved (list const& movements, b *alist.get (), &before, &alist->get_state ())); } } + + /* move mute automation (route owned control) */ + std::shared_ptr alist = _track.mute_control ()->alist (); + if (alist->size ()) { + XMLNode& before = alist->get_state (); + bool const things_moved = alist->move_ranges (movements); + if (things_moved) { + _session.add_command (new MementoCommand ( + *alist.get (), &before, &alist->get_state ())); + } + } + /* move processor automation */ _track.foreach_processor (boost::bind (&DiskReader::move_processor_automation, this, _1, movements)); } From 58120f75d52be7365c0ca25eb284391ef894b9d9 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 12 Aug 2024 21:23:39 +0200 Subject: [PATCH 2/3] Add API to check if backend was used previously This is backported from LiveTrax, yet potentially handy for future auto-connect policy in Ardour as well. --- libs/ardour/ardour/session.h | 1 + libs/ardour/session.cc | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 38bda1bd05..91440d837d 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -261,6 +261,7 @@ public: bool cannot_save () const { return _state_of_the_state & CannotSave; } bool in_cleanup () const { return _state_of_the_state & InCleanup; } bool inital_connect_or_deletion_in_progress () const { return _state_of_the_state & (InitialConnecting | Deletion); } + bool have_external_connections_for_current_backend (bool tracks_only = true) const; bool unnamed() const; void end_unnamed_status () const; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index bf430c72fd..76a1c7df33 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -8158,3 +8158,27 @@ Session::foreach_route (void (Route::*method)()) } } +bool +Session::have_external_connections_for_current_backend (bool tracks_only) const +{ + std::shared_ptr rl = routes.reader(); + for (auto const& r : *rl) { + if (tracks_only && !std::dynamic_pointer_cast (r)) { + continue; + } + if (r->is_singleton ()) { + continue; + } + for (auto const& p : *r->input()->ports()) { + if (p->has_ext_connection ()) { + return true; + } + } + for (auto const& p : *r->output()->ports()) { + if (p->has_ext_connection ()) { + return true; + } + } + } + return false; +} From 3bdf378df333b17f6fa14b3a733fa001e3c8a461 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 12 Aug 2024 21:36:55 +0200 Subject: [PATCH 3/3] Add some additional Lua bindings --- libs/ardour/luabindings.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc index 0d737106bb..c7768296c6 100644 --- a/libs/ardour/luabindings.cc +++ b/libs/ardour/luabindings.cc @@ -3439,6 +3439,9 @@ LuaBindings::session (lua_State* L) .addFunction ("unknown_processors", &Session::unknown_processors) .addFunction ("export_track_state", &Session::export_track_state) .addFunction ("selection", &Session::selection) + .addFunction ("have_external_connections_for_current_backend", &Session::have_external_connections_for_current_backend) + .addFunction ("unnamed", &Session::unnamed) + .addFunction ("writable", &Session::writable) .addFunction ("new_route_from_template", &Session::new_route_from_template) // TODO session_add_audio_track session_add_midi_track session_add_mixed_track