From b043336c867a3731f0bf7285ea5a76b051823e7f Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 27 Nov 2020 00:11:41 +0100 Subject: [PATCH] Fix monitor-sends with templates This fixes an issues with missing monitor-sends when creating a session from a template with monitor-section, or when creating tracks from a route-template. --- libs/ardour/session.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 759f801362..09bb953959 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -398,6 +398,7 @@ Session::Session (AudioEngine &eng, } } + /* apply the loaded state_tree */ int err = post_engine_init (); if (err) { @@ -422,6 +423,22 @@ Session::Session (AudioEngine &eng, } } + if (!mix_template.empty()) { + /* fixup monitor-sends */ + if (Config->get_use_monitor_bus ()) { + /* Session::config_changed will have set use-monitor-bus to match the template. + * search for want_ms, have_ms + */ + assert (_monitor_out); + /* ..but sends do not exist, since templated track bitslots are unset */ + setup_route_monitor_sends (true, true); + } else { + /* remove any monitor-sends that may be in the template */ + assert (!_monitor_out); + setup_route_monitor_sends (false, true); + } + } + if (!unnamed) { store_recent_sessions (_name, _path); } @@ -3057,6 +3074,21 @@ Session::new_route_from_template (uint32_t how_many, PresentationInfo::order_t i IO::enable_connecting (); + if (!ret.empty()) { + /* set/unset monitor-send */ + Glib::Threads::Mutex::Lock lm (_engine.process_lock()); + for (RouteList::iterator x = ret.begin(); x != ret.end(); ++x) { + if ((*x)->can_solo ()) { + if (_monitor_out) { + (*x)->enable_monitor_send (); + } else { + /* this may happen with old templates */ + (*x)->remove_monitor_send (); + } + } + } + } + return ret; }