diff options
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 56 | ||||
-rw-r--r-- | gtk2_ardour/mixer_strip.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/route.h | 2 | ||||
-rw-r--r-- | libs/ardour/route.cc | 8 |
4 files changed, 55 insertions, 13 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index 5a8442dc44..4d8d196b4b 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -355,6 +355,12 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) delete output_selector; output_selector = 0; + if (_current_send) { + _current_send->set_metering (false); + } + + _current_send.reset (); + panners.set_io (rt); gpm.set_io (rt); pre_processor_box.set_route (rt); @@ -401,10 +407,12 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt) rec_enable_button->show(); } else if (!is_track()) { - /* bus */ + /* non-master bus */ - button_table.attach (*show_sends_button, 0, 2, 2, 3); - show_sends_button->show(); + if (!_route->is_master()) { + button_table.attach (*show_sends_button, 0, 2, 2, 3); + show_sends_button->show(); + } } if (_route->phase_invert()) { @@ -1494,15 +1502,33 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target) { boost::shared_ptr<IO> to_display; - if (_route == target) { - /* don't change the display for the target */ + if (_route == target || _route->is_master()) { + /* don't change the display for the target or the master bus */ return; + } else if (!is_track() && show_sends_button) { + /* make sure our show sends button is inactive, + since we're not the target. + */ + show_sends_button->set_active (false); } if (!target) { - to_display = _route; - } else { - to_display = _route->send_io_for (target); + /* switch back to default */ + revert_to_default_display (); + return; + } + + if (_current_send) { + _current_send->set_metering (false); + } + + _current_send = _route->send_for (target); + + if (_current_send) { + to_display = _current_send->io(); + + _current_send->set_metering (true); + _current_send->GoingAway.connect (mem_fun (*this, &MixerStrip::revert_to_default_display)); } gain_meter().set_io (to_display); @@ -1510,3 +1536,17 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target) panner_ui().set_io (to_display); panner_ui().setup_pan (); } + +void +MixerStrip::revert_to_default_display () +{ + if (_current_send) { + _current_send->set_metering (false); + _current_send.reset(); + } + + gain_meter().set_io (_route); + gain_meter().setup_meters (); + panner_ui().set_io (_route); + panner_ui().setup_pan (); +} diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h index 958bfc9422..f0cc4c67c6 100644 --- a/gtk2_ardour/mixer_strip.h +++ b/gtk2_ardour/mixer_strip.h @@ -263,6 +263,8 @@ class MixerStrip : public RouteUI, public Gtk::EventBox void engine_stopped(); void switch_io (boost::shared_ptr<ARDOUR::Route>); + boost::shared_ptr<ARDOUR::Send> _current_send; + void revert_to_default_display (); static int scrollbar_height; }; diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 10aec0446e..8de82bb219 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -181,7 +181,7 @@ class Route : public IO boost::shared_ptr<Delivery> control_outs() const { return _control_outs; } boost::shared_ptr<Delivery> main_outs() const { return _main_outs; } - boost::shared_ptr<IO> send_io_for (boost::shared_ptr<const IO> target) const; + boost::shared_ptr<Send> send_for (boost::shared_ptr<const IO> target) const; /** A record of the stream configuration at some point in the processor list. * Used to return where and why an processor list configuration request failed. diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 7fb063eae0..ccdd523654 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -2683,8 +2683,8 @@ Route::set_name (const string& str) return ret; } -boost::shared_ptr<IO> -Route::send_io_for (boost::shared_ptr<const IO> target) const +boost::shared_ptr<Send> +Route::send_for (boost::shared_ptr<const IO> target) const { Glib::RWLock::ReaderLock lm (_processor_lock); @@ -2693,10 +2693,10 @@ Route::send_io_for (boost::shared_ptr<const IO> target) const if ((send = boost::dynamic_pointer_cast<Send>(*i)) != 0) { if (send->io()->connected_to (target)) { - return send->io(); + return send; } } } - return boost::shared_ptr<IO>(); + return boost::shared_ptr<Send>(); } |