From 56471fd3527416672664700bd2c1491419ced57a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 26 May 2016 15:42:33 +0200 Subject: [PATCH] ensure that amp/fader is present on every route --- libs/ardour/route.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 6cd593d5ad..49528e30e3 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -172,14 +172,9 @@ Route::init () _output->changed.connect_same_thread (*this, boost::bind (&Route::output_change_handler, this, _1, _2)); _output->PortCountChanging.connect_same_thread (*this, boost::bind (&Route::output_port_count_changing, this, _1)); -#if 0 // not used - just yet - if (!is_master() && !is_monitor() && !is_auditioner()) { - _delayline.reset (new DelayLine (_session, _name)); - add_processor (_delayline, PreFader); - } -#endif - - /* add amp processor */ + /* add the amp/fader processor. + * it should be the first processor to be added on every route. + */ _gain_control = boost::shared_ptr (new GainControllable (_session, GainAutomation, shared_from_this ())); add_control (_gain_control); @@ -191,6 +186,13 @@ Route::init () _amp->set_display_name (_("Monitor")); } +#if 0 // not used - just yet + if (!is_master() && !is_monitor() && !is_auditioner()) { + _delayline.reset (new DelayLine (_session, _name)); + add_processor (_delayline, PreFader); + } +#endif + /* and input trim */ _trim_control = boost::shared_ptr (new GainControllable (_session, TrimAutomation, shared_from_this ())); @@ -5051,12 +5053,13 @@ Route::setup_invisible_processors () /* find the amp */ - ProcessorList::iterator amp = new_processors.begin (); - while (amp != new_processors.end() && *amp != _amp) { - ++amp; - } + ProcessorList::iterator amp = find (new_processors.begin(), new_processors.end(), _amp); - assert (amp != new_processors.end ()); + if (amp == new_processors.end ()) { + error << string_compose (_("Amp/Fader on Route '%1' went AWOL. Re-added."), name()) << endmsg; + new_processors.push_front (_amp); + amp = find (new_processors.begin(), new_processors.end(), _amp); + } /* and the processor after the amp */ -- 2.30.2