provide solo mute gain Config parameter as a controllable and use it in the monitor...
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Feb 2011 16:14:54 +0000 (16:14 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Fri, 11 Feb 2011 16:14:54 +0000 (16:14 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@8825 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/monitor_section.cc
gtk2_ardour/monitor_section.h
gtk2_ardour/volume_controller.cc [deleted file]
gtk2_ardour/volume_controller.h [deleted file]
gtk2_ardour/wscript
libs/ardour/ardour/session.h
libs/ardour/session.cc
libs/ardour/session_state.cc

index c281b0ccaf9d4069f2a68ad5fa075e225d99017c..18309330484fa80751632536d78a4a72e6c4c3d1 100644 (file)
@@ -18,7 +18,6 @@
 #include "monitor_section.h"
 #include "public_editor.h"
 #include "utils.h"
-#include "volume_controller.h"
 
 #include "i18n.h"
 
@@ -155,7 +154,7 @@ MonitorSection::MonitorSection (Session* s)
 
         /* Solo (SiP) cut */
 
-        solo_cut_control = new VolumeController (little_knob_pixbuf, &solo_cut_adjustment, false, 30, 30);
+        solo_cut_control = new MotionFeedback (little_knob_pixbuf, MotionFeedback::Rotary, "", &solo_cut_adjustment, false, 30, 30);
 
         spin_label = manage (new Label (_("SiP Cut")));
         spin_packer = manage (new VBox);
@@ -310,25 +309,26 @@ MonitorSection::set_session (Session* s)
                 _route = _session->monitor_out ();
 
                 if (_route) {
-                        /* session with control outs */
+                        /* session with monitor section */
                         _monitor = _route->monitor_control ();
                         assign_controllables ();
                 } else { 
-                        /* session with no control outs */
+                        /* session with no monitor section */
                         _monitor.reset ();
                         _route.reset ();
                 }
                 
         } else {
                 /* no session */
+
                 _monitor.reset ();
                 _route.reset ();
                 control_connections.drop_connections ();
                 rude_iso_button.set_active (false);
                 rude_solo_button.set_active (false);
-        }
 
-        /* both might be null */
+                assign_controllables ();
+        }
 }
 
 MonitorSection::ChannelButtonSet::ChannelButtonSet ()
@@ -628,9 +628,6 @@ MonitorSection::register_actions ()
         tact = Glib::RefPtr<ToggleAction>::cast_dynamic(act);
         tact->set_active (Config->get_solo_mute_override());
 
-        /* map from RC config */
-
-
 
         /* note the 1-based counting (for naming - backend uses 0-based) */
 
@@ -1014,6 +1011,12 @@ MonitorSection::assign_controllables ()
                 return;
         }
 
+        if (_session) {
+                solo_cut_control->set_controllable (_session->solo_cut_control());
+        } else {
+                solo_cut_control->set_controllable (none);
+        }
+
         if (_route) {
                 gain_control->set_controllable (_route->gain_control());
                 control_link (control_connections, _route->gain_control(), gain_adjustment);
index bc502d9979bdb84a91ea043d9bc95f0d203c3590..462cdbc80b3d432dbfdaadadb4ea5bfdcdd846a8 100644 (file)
@@ -31,8 +31,6 @@ namespace Gtkmm2ext {
         class MotionFeedback;
 }
 
-class VolumeController;
-
 class MonitorSection : public RouteUI
 {
   public:
@@ -71,7 +69,7 @@ class MonitorSection : public RouteUI
         Gtk::Adjustment   solo_boost_adjustment;
         Gtkmm2ext::MotionFeedback* solo_boost_control;
         Gtk::Adjustment   solo_cut_adjustment;
-        VolumeController* solo_cut_control;
+        Gtkmm2ext::MotionFeedback* solo_cut_control;
 
         void populate_buttons ();
        void set_button_names ();
diff --git a/gtk2_ardour/volume_controller.cc b/gtk2_ardour/volume_controller.cc
deleted file mode 100644 (file)
index 8cf6e68..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-    Copyright (C) 1998-2007 Paul Davis
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: volume_controller.cc,v 1.4 2000/05/03 15:54:21 pbd Exp $
-*/
-
-#include <string.h>
-#include <limits.h>
-
-#include "volume_controller.h"
-
-using namespace Gtk;
-
-VolumeController::VolumeController (Glib::RefPtr<Gdk::Pixbuf> p,
-                                   Gtk::Adjustment *adj,
-                                   bool with_numeric,
-                                    int subw, int subh)
-
-       : MotionFeedback (p, MotionFeedback::Rotary, "", adj, with_numeric, subw, subh)
-{                        
-       get_adjustment()->signal_value_changed().connect (mem_fun (*this,&VolumeController::adjustment_value_changed));
-}
-
-void
-VolumeController::adjustment_value_changed ()
-{
-        
-}
-
-
diff --git a/gtk2_ardour/volume_controller.h b/gtk2_ardour/volume_controller.h
deleted file mode 100644 (file)
index f348b00..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-    Copyright (C) 1998-2007 Paul Davis 
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-    $Id: volume_controller.h,v 1.4 2000/05/03 15:54:21 pbd Exp $
-*/
-
-#ifndef __gtk_ardour_vol_controller_h__
-#define __gtk_ardour_vol_controller_h__
-
-#include <gtkmm/adjustment.h>
-
-#include "gtkmm2ext/motionfeedback.h"
-
-// march 2010: this exists as a placeholder to add a controllable, but maybe it will
-// end up in MotionFeedback
-
-class VolumeController : public Gtkmm2ext::MotionFeedback
-{
-  public:
-       VolumeController (Glib::RefPtr<Gdk::Pixbuf>,
-                         Gtk::Adjustment *adj,
-                         bool with_numeric = true,
-                          int image_width = 40,
-                          int image_height = 40);
-
-        virtual ~VolumeController () {}
-
-  private:
-       Gtk::Adjustment *adjustment;
-       void adjustment_value_changed ();
-};
-
-#endif // __gtk_ardour_vol_controller_h__              
-
-
index b50521ec76bdf6e00960d666fe2944fbea45f54a..503dca9bcc3cc28fae561f27caafe3cbc59f2597 100644 (file)
@@ -221,7 +221,6 @@ gtk2_ardour_sources = [
        'ui_config.cc',
        'utils.cc',
        'version.cc',
-        'volume_controller.cc',
        'waveview.cc',
        'window_proxy.cc'
 ]
index 44ab172720e381e2adfe37a6030a08480f535225..0970e01b5cb2c2e3cdf204dabca3f351ef648d07 100644 (file)
@@ -731,6 +731,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        void add_controllable (boost::shared_ptr<PBD::Controllable>);
        void remove_controllable (PBD::Controllable*);
 
+        boost::shared_ptr<PBD::Controllable> solo_cut_control() const;
+
        SessionMetadata & metadata () { return *_metadata; }
 
        SessionConfiguration config;
@@ -1419,6 +1421,8 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi
        Glib::Mutex controllables_lock;
        Controllables controllables;
 
+        boost::shared_ptr<PBD::Controllable> _solo_cut_control;
+
        void reset_native_file_format();
        bool first_file_data_format_reset;
        bool first_file_header_format_reset;
index de0076372f274a4840a0cb49948bd6db40194799..da18b61681f9e9691f04c9e3fd27f152e73d4094 100644 (file)
@@ -136,8 +136,7 @@ Session::Session (AudioEngine &eng,
                  const string& snapshot_name,
                   BusProfile* bus_profile,
                  string mix_template)
-
-       : _engine (eng)
+        : _engine (eng)
        , _target_transport_speed (0.0)
        , _requested_return_frame (-1)
        , _session_dir (new SessionDirectory(fullpath))
@@ -4234,3 +4233,4 @@ Session::unknown_processors () const
 
        return p;
 }
+
index 31c1c439a83ef6cbf7cdfd8b2d481277452d0d03..17fedfb8a4ae30d7fbd8cf5621211abaf6e6d0a0 100644 (file)
@@ -95,6 +95,7 @@
 #include "ardour/pannable.h"
 #include "ardour/processor.h"
 #include "ardour/port.h"
+#include "ardour/proxy_controllable.h"
 #include "ardour/region_factory.h"
 #include "ardour/route_group.h"
 #include "ardour/send.h"
@@ -270,6 +271,10 @@ Session::first_stage_init (string fullpath, string snapshot_name)
        delta_accumulator_cnt = 0;
        _slave_state = Stopped;
 
+        _solo_cut_control.reset (new ProxyControllable (_("solo cut control (dB)"), PBD::Controllable::GainLike,
+                                                        boost::bind (&RCConfiguration::set_solo_mute_gain, Config, _1),
+                                                        boost::bind (&RCConfiguration::get_solo_mute_gain, Config)));
+
        _engine.GraphReordered.connect_same_thread (*this, boost::bind (&Session::graph_reordered, this));
 
        /* These are all static "per-class" signals */
@@ -3521,3 +3526,18 @@ Session::setup_midi_machine_control ()
        mmc->SPPContinue.connect_same_thread (*this, boost::bind (&Session::spp_continue, this, _1, _2));
        mmc->SPPStop.connect_same_thread (*this, boost::bind (&Session::spp_stop, this, _1, _2));
 }
+
+boost::shared_ptr<Controllable>
+Session::solo_cut_control() const
+{
+        /* the solo cut control is a bit of an anomaly, at least as of Febrary 2011. There are no other
+           controls in Ardour that currently get presented to the user in the GUI that require
+           access as a Controllable and are also NOT owned by some SessionObject (e.g. Route, or MonitorProcessor).
+
+           its actually an RCConfiguration parameter, so we use a ProxyControllable to wrap
+           it up as a Controllable. Changes to the Controllable will just map back to the RCConfiguration
+           parameter.
+        */
+        
+        return _solo_cut_control;
+}