add option to limit track-header meters to stereo
authorRobin Gareus <robin@gareus.org>
Wed, 4 May 2016 15:36:40 +0000 (17:36 +0200)
committerRobin Gareus <robin@gareus.org>
Wed, 4 May 2016 15:36:40 +0000 (17:36 +0200)
gtk2_ardour/level_meter.cc
gtk2_ardour/level_meter.h
gtk2_ardour/rc_option_editor.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/ui_config_vars.h

index d9f31303dd9d51a919b2e257a147e8e2b7f667db..114c28c708756e27d152edf060fb60fa4e776523 100644 (file)
@@ -51,7 +51,8 @@ LevelMeterBase::LevelMeterBase (Session* s, PBD::EventLoop::InvalidationRecord*
        , max_peak (minus_infinity())
        , meter_type (MeterPeak)
        , visible_meter_type (MeterType(0))
-       , visible_meter_count (0)
+       , meter_count (0)
+       , max_visible_meters (0)
        , color_changed (false)
 {
        set_session (s);
@@ -230,7 +231,18 @@ LevelMeterBase::hide_all_meters ()
                        (*i).packed = false;
                }
        }
-       visible_meter_count = 0;
+       meter_count = 0;
+}
+
+void
+LevelMeterBase::set_max_audio_meter_count (uint32_t cnt)
+{
+       if (cnt == max_visible_meters) {
+               return;
+       }
+       color_changed = true; // force re-setup
+       max_visible_meters = cnt;
+       setup_meters (meter_length, regular_meter_width, thin_meter_width);
 }
 
 void
@@ -264,7 +276,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
        width = rint (width * UIConfiguration::instance().get_ui_scale());
 
        if (   meters.size() > 0
-           && nmeters == visible_meter_count
+           && nmeters == meter_count
            && meters[0].width == width
            && meters[0].length == len
            && !color_changed
@@ -277,7 +289,7 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
                        (meters.size() > 0) ? "yes" : "no",
                        (meters.size() > 0 &&  meters[0].width == width) ? "yes" : "no",
                        (meters.size() > 0 &&  meters[0].length == len) ? "yes" : "no",
-                       (nmeters == visible_meter_count) ? "yes" : "no",
+                       (nmeters == meter_count) ? "yes" : "no",
                        (meter_type == visible_meter_type) ? "yes" : "no",
                        !color_changed ? "yes" : "no"
                        );
@@ -459,13 +471,17 @@ LevelMeterBase::setup_meters (int len, int initial_width, int thin_width)
 
                //pack_end (*meters[n].meter, false, false);
                mtr_pack (*meters[n].meter);
-               meters[n].meter->show_all ();
                meters[n].packed = true;
+               if (max_visible_meters == 0 || (uint32_t) n < max_visible_meters + nmidi) {
+                       meters[n].meter->show_all ();
+               } else {
+                       meters[n].meter->hide ();
+               }
        }
        //show();
        color_changed = false;
        visible_meter_type = meter_type;
-       visible_meter_count = nmeters;
+       meter_count = nmeters;
 }
 
 void
index a7a64d7559f7950ea8630b70e5e785ab5b187308..758b94c37bd310e72a9468176dc9c225ecea9ed4 100644 (file)
@@ -65,6 +65,7 @@ class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::tra
        void clear_meters (bool reset_highlight = true);
        void hide_meters ();
        void setup_meters (int len=0, int width=3, int thin=2);
+       void set_max_audio_meter_count (uint32_t cnt = 0);
 
        void set_type (ARDOUR::MeterType);
        ARDOUR::MeterType get_type () { return meter_type; }
@@ -108,7 +109,8 @@ class LevelMeterBase : public ARDOUR::SessionHandlePtr, virtual public sigc::tra
        float                  max_peak;
        ARDOUR::MeterType      meter_type;
        ARDOUR::MeterType      visible_meter_type;
-       uint32_t               visible_meter_count;
+       uint32_t               meter_count;
+       uint32_t               max_visible_meters;
 
        PBD::ScopedConnection _configuration_connection;
        PBD::ScopedConnection _meter_type_connection;
index f11585e31b6a069384cddeced6ad1188b07d90bb..fc340534f43a4928bfc1fc7c9ef073d6734b8332 100644 (file)
@@ -2216,14 +2216,6 @@ RCOptionEditor::RCOptionEditor ()
                     sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_draggable_playhead)
                     ));
 
-       add_option (_("Editor"),
-            new BoolOption (
-                    "show-track-meters",
-                    _("Show meters on tracks in the editor"),
-                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_track_meters),
-                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_track_meters)
-                    ));
-
        add_option (_("Editor"),
             new BoolOption (
                     "show-editor-meter",
@@ -3294,6 +3286,24 @@ if (!ARDOUR::Profile->get_mixbus()) {
                     sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_meter_style_led)
                     ));
 
+       add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Editor Meters")));
+
+       add_option (S_("Preferences|Metering"),
+            new BoolOption (
+                    "show-track-meters",
+                    _("Show meters on tracks in the editor"),
+                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_show_track_meters),
+                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_show_track_meters)
+                    ));
+
+       add_option (S_("Preferences|Metering"),
+            new BoolOption (
+                    "editor-stereo-only-meters",
+                    _("Show at most stereo meters in the track-header"),
+                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::get_editor_stereo_only_meters),
+                    sigc::mem_fun (UIConfiguration::instance(), &UIConfiguration::set_editor_stereo_only_meters)
+                    ));
+
        add_option (S_("Preferences|Metering"), new OptionEditorHeading (_("Post Export Analysis")));
 
        add_option (S_("Preferences|Metering"),
index 8243a78ca1eb36cef800e8baa37e7dfc3c9119dd..986a274ee620bad34ec1bf53bba77ce56e86f387 100644 (file)
@@ -124,6 +124,9 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan
        number_label.set_fallthrough_to_parent (true);
 
        sess->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::parameter_changed, this, _1), gui_context());
+       UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &RouteTimeAxisView::parameter_changed));
+
+       parameter_changed ("editor-stereo-only-meters");
 }
 
 void
@@ -441,6 +444,12 @@ RouteTimeAxisView::parameter_changed (string const & p)
 {
        if (p == "track-name-number") {
                update_track_number_visibility();
+       } else if (p == "editor-stereo-only-meters") {
+               if (UIConfiguration::instance().get_editor_stereo_only_meters()) {
+                       gm.get_level_meter().set_max_audio_meter_count (2);
+               } else {
+                       gm.get_level_meter().set_max_audio_meter_count (0);
+               }
        }
 }
 
index 0621aa81fbc6da3ab2b09b948d76e816d40120dd..1e7b987136524e04d596475064f96974cc31a531 100644 (file)
@@ -58,6 +58,7 @@ UI_CONFIG_VARIABLE (bool, show_name_highlight, "show-name-highlight", false)
 UI_CONFIG_VARIABLE (bool, primary_clock_delta_edit_cursor, "primary-clock-delta-edit-cursor", false)
 UI_CONFIG_VARIABLE (bool, secondary_clock_delta_edit_cursor, "secondary-clock-delta-edit-cursor", false)
 UI_CONFIG_VARIABLE (bool, show_track_meters, "show-track-meters", true)
+UI_CONFIG_VARIABLE (bool, editor_stereo_only_meters, "editor-stereo-only-meters", false)
 UI_CONFIG_VARIABLE (bool, follow_edits, "follow-edits", false)
 UI_CONFIG_VARIABLE (bool, super_rapid_clock_update, "super-rapid-clock-update", false)
 UI_CONFIG_VARIABLE (bool, autoscroll_editor, "autoscroll-editor", true)