From dba2473cb6a8f2efe5f733f9ac684d4a1029f3cf Mon Sep 17 00:00:00 2001 From: GZharun Date: Tue, 11 Nov 2014 12:28:55 +0200 Subject: [PATCH] [Summary] Refactored routes auto connection mechanism. Fixed bug when master track get's disconnected, eliminated redundant calls --- libs/ardour/session.cc | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 607bf0c5db..2d7f5d0018 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2085,7 +2085,7 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost: failed: if (!new_routes.empty()) { StateProtector sp (this); - add_routes (new_routes, true, true, true); + add_routes (new_routes, false, false, true); if (instrument) { for (RouteList::iterator r = new_routes.begin(); r != new_routes.end(); ++r) { @@ -2326,6 +2326,10 @@ Session::reconnect_existing_routes (bool withLock, bool reconnect_master, bool r continue; } + if (*rIter == _master_track && !reconnect_master ) { + continue; + } + if (reconnectIputs) { (*rIter)->input()->disconnect (this); //GZ: check this; could be heavy @@ -2581,7 +2585,7 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod failed: if (!new_routes.empty()) { StateProtector sp (this); - add_routes (new_routes, true, true, true); + add_routes (new_routes, false, false, true); } return ret; @@ -2749,7 +2753,7 @@ Session::new_audio_route (int input_channels, int output_channels, RouteGroup* r failure: if (!ret.empty()) { StateProtector sp (this); - add_routes (ret, false, true, true); // autoconnect outputs only + add_routes (ret, false, false, true); // autoconnect outputs only } return ret; @@ -2866,7 +2870,7 @@ Session::new_route_from_template (uint32_t how_many, const std::string& template out: if (!ret.empty()) { StateProtector sp (this); - add_routes (ret, true, true, true); + add_routes (ret, false, false, true); IO::enable_connecting (); } @@ -2979,8 +2983,7 @@ Session::add_routes_inner (RouteList& new_routes, bool input_auto_connect, bool } if (input_auto_connect || output_auto_connect) { - // routes will be connected later - //auto_connect_route (r, existing_inputs, existing_outputs, true, input_auto_connect); + auto_connect_route (r, existing_inputs, existing_outputs, true, input_auto_connect); } /* order keys are a GUI responsibility but we need to set up @@ -3192,7 +3195,7 @@ Session::remove_routes (boost::shared_ptr routes_to_remove) */ long reconnect_start_time = get_time_measurement(); if (ARDOUR::Profile->get_trx () ) { - reconnect_existing_routes(true, true); + reconnect_existing_routes(true, false); } else { resort_routes (); } @@ -3314,7 +3317,7 @@ Session::remove_route (boost::shared_ptr route) * Wave Tracks: reconnect routes */ if (ARDOUR::Profile->get_trx () ) { - reconnect_existing_routes(true, true); + reconnect_existing_routes(true, false); } else { resort_routes (); } @@ -5938,8 +5941,8 @@ Session::notify_remote_id_change () break; } - /* Waves Tracks: for Waves Tracks session it's required to reconnect their IOs if track order has been changed in GUI - * TODO: move it to GUI + /* Waves Tracks: for Waves Tracks session it's required to reconnect their IOs + * if track order has been changed by user */ if (ARDOUR::Profile->get_trx () ) { reconnect_existing_routes(true, true);