Make the trim knob on busses show only if there is audio
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Thu, 21 Jul 2016 22:44:22 +0000 (00:44 +0200)
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>
Sun, 24 Jul 2016 11:51:11 +0000 (13:51 +0200)
The trim knob has been designed to operate only on audio channels. If
the bus has none, hide the knob that would otherwise have no effect at
all.

Factor the trim control show/hide code out of MixerStrip::set_route(),
and also call that code in response to I/O changes in the route.

gtk2_ardour/mixer_strip.cc
gtk2_ardour/mixer_strip.h

index b5ae269c7fb65864bd16f60df36bd108496bf0ab..1e8717d3279ad313855868d30ca4abbcb7098697 100644 (file)
@@ -457,6 +457,20 @@ MixerStrip::name() const
        return string();
 }
 
+void
+MixerStrip::update_trim_control ()
+{
+       if (route()->trim() && route()->trim()->active() &&
+           route()->n_inputs().n_audio() > 0) {
+               trim_control.show ();
+               trim_control.set_controllable (route()->trim()->gain_control());
+       } else {
+               trim_control.hide ();
+               boost::shared_ptr<Controllable> none;
+               trim_control.set_controllable (none);
+       }
+}
+
 void
 MixerStrip::set_route (boost::shared_ptr<Route> rt)
 {
@@ -563,14 +577,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
                monitor_disk_button->hide ();
        }
 
-       if (route()->trim() && route()->trim()->active()) {
-               trim_control.show ();
-               trim_control.set_controllable (route()->trim()->gain_control());
-       } else {
-               trim_control.hide ();
-               boost::shared_ptr<Controllable> none;
-               trim_control.set_controllable (none);
-       }
+       update_trim_control();
 
        if (is_midi_track()) {
                if (midi_input_enable_button == 0) {
@@ -1509,6 +1516,7 @@ void
 MixerStrip::io_changed_proxy ()
 {
        Glib::signal_idle().connect_once (sigc::mem_fun (*this, &MixerStrip::update_panner_choices));
+       Glib::signal_idle().connect_once (sigc::mem_fun (*this, &MixerStrip::update_trim_control));
 }
 
 void
index c1c1726902aa1bf5e34e6a07072fcdd6c4bd191e..eb6da17f87823ad705cad8753c65a962f666f742 100644 (file)
@@ -253,6 +253,7 @@ class MixerStrip : public AxisView, public RouteUI, public Gtk::EventBox
        PBD::ScopedConnection panstyle_connection;
        void connect_to_pan ();
        void update_panner_choices ();
+       void update_trim_control ();
 
        void update_diskstream_display ();
        void update_input_display ();