add Slavable API for VCA assign/unassign
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 25 Apr 2016 01:47:52 +0000 (21:47 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 31 May 2016 19:30:41 +0000 (15:30 -0400)
libs/ardour/ardour/route.h
libs/ardour/ardour/vca.h
libs/ardour/route.cc
libs/ardour/vca.cc
libs/ardour/wscript

index 46c5b1f3c7a7a57d97cc3d54bad8189cbc8d96f2..52be8c94b40142dd90165bddb836c336e42f0db9 100644 (file)
@@ -57,6 +57,7 @@
 #include "ardour/soloable.h"
 #include "ardour/solo_control.h"
 #include "ardour/solo_safe_control.h"
+#include "ardour/slavable.h"
 
 class RoutePinWindowProxy;
 
@@ -83,13 +84,14 @@ class SoloIsolateControl;
 class PhaseControl;
 class MonitorControl;
 
-class LIBARDOUR_API Route : public Stripable,
+class LIBARDOUR_API Route : public GraphNode,
+                            public Stripable,
                             public Soloable,
                             public Muteable,
                             public Monitorable,
                             public Automatable,
                             public RouteGroupMember,
-                            public GraphNode,
+                            public Slavable,
                             public boost::enable_shared_from_this<Route>
 {
 public:
@@ -599,8 +601,6 @@ public:
                        pframes_t nframes, int declick);
 
         bool slaved_to (boost::shared_ptr<VCA>) const;
-        void vca_assign (boost::shared_ptr<VCA>);
-        void vca_unassign (boost::shared_ptr<VCA>);
 
   protected:
         friend class Session;
@@ -611,8 +611,11 @@ public:
        void curve_reallocate ();
        virtual void set_block_size (pframes_t nframes);
 
-protected:
-       virtual framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&) { return nframes; }
+  protected:
+       int assign_controls (boost::shared_ptr<VCA>);
+       int unassign_controls (boost::shared_ptr<VCA>);
+
+        virtual framecnt_t check_initial_delay (framecnt_t nframes, framepos_t&) { return nframes; }
 
        void fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr<IO> io, pframes_t nframes);
 
index 9af6436f6bc1c1dbe004a331f30ef5028497a84a..a3dfb3ec076f091dfdef7eba4a48396370723bd4 100644 (file)
@@ -29,6 +29,7 @@
 #include "ardour/automatable.h"
 #include "ardour/muteable.h"
 #include "ardour/soloable.h"
+#include "ardour/slavable.h"
 #include "ardour/stripable.h"
 
 namespace ARDOUR {
@@ -39,7 +40,7 @@ class SoloControl;
 class MuteControl;
 class MonitorControl;
 
-class LIBARDOUR_API VCA : public Stripable, public Soloable, public Muteable, public Automatable, public boost::enable_shared_from_this<VCA> {
+class LIBARDOUR_API VCA : public Stripable, public Soloable, public Muteable, public Automatable, public Slavable, public boost::enable_shared_from_this<VCA> {
   public:
        VCA (Session& session,  uint32_t num, const std::string& name);
        ~VCA();
@@ -108,6 +109,10 @@ class LIBARDOUR_API VCA : public Stripable, public Soloable, public Muteable, pu
        virtual std::string send_name (uint32_t n) const { return std::string(); }
        virtual boost::shared_ptr<AutomationControl> master_send_enable_controllable () const { return boost::shared_ptr<AutomationControl>(); }
 
+  protected:
+       int assign_controls (boost::shared_ptr<VCA>);
+       int unassign_controls (boost::shared_ptr<VCA>);
+
   private:
        uint32_t    _number;
 
index 78e0228382087aa026e13f794ca34932bdf23a49..301c7ba5c0c05e538b096e040d69ef07e2aa87b7 100644 (file)
@@ -86,10 +86,10 @@ PBD::Signal3<int,boost::shared_ptr<Route>, boost::shared_ptr<PluginInsert>, Rout
 
 /** Base class for all routable/mixable objects (tracks and busses) */
 Route::Route (Session& sess, string name, Flag flg, DataType default_type)
-       : Stripable (sess, name)
+       : GraphNode (sess._process_graph)
+       , Stripable (sess, name)
        , Muteable (sess, name)
        , Automatable (sess)
-       , GraphNode (sess._process_graph)
        , _active (true)
        , _signal_latency (0)
        , _signal_latency_at_amp_position (0)
@@ -5447,16 +5447,18 @@ Route::slaved_to (boost::shared_ptr<VCA> vca) const
        return _gain_control->slaved_to (vca->gain_control());
 }
 
-void
-Route::vca_assign (boost::shared_ptr<VCA> vca)
+int
+Route::assign_controls (boost::shared_ptr<VCA> vca)
 {
        _gain_control->add_master (vca->gain_control());
        _solo_control->add_master (vca->solo_control());
        _mute_control->add_master (vca->mute_control());
+
+       return 0;
 }
 
-void
-Route::vca_unassign (boost::shared_ptr<VCA> vca)
+int
+Route::unassign_controls (boost::shared_ptr<VCA> vca)
 {
        if (!vca) {
                /* unassign from all */
@@ -5468,6 +5470,8 @@ Route::vca_unassign (boost::shared_ptr<VCA> vca)
                _solo_control->remove_master (vca->solo_control());
                _mute_control->remove_master (vca->mute_control());
        }
+
+       return 0;
 }
 
 bool
index 0e33dca6e2b15734265efd593168dbed87289522..2ab84d55705bb1410afdf24689c9b49292c2ef23 100644 (file)
@@ -152,3 +152,30 @@ VCA::clear_all_solo_state ()
 {
        _solo_control->clear_all_solo_state ();
 }
+
+int
+VCA::assign_controls (boost::shared_ptr<VCA> vca)
+{
+       _gain_control->add_master (vca->gain_control());
+       _solo_control->add_master (vca->solo_control());
+       _mute_control->add_master (vca->mute_control());
+
+       return 0;
+}
+
+int
+VCA::unassign_controls (boost::shared_ptr<VCA> vca)
+{
+       if (!vca) {
+               /* unassign from all */
+               _gain_control->clear_masters ();
+               _solo_control->clear_masters ();
+               _mute_control->clear_masters ();
+       } else {
+               _gain_control->remove_master (vca->gain_control());
+               _solo_control->remove_master (vca->solo_control());
+               _mute_control->remove_master (vca->mute_control());
+       }
+
+       return 0;
+}
index 17876f889b9a4445c3052b9db98fcf247e2f95e8..9a9b650a66af585b43150f19ef8ef94acb61a732 100644 (file)
@@ -211,6 +211,7 @@ libardour_sources = [
         'session_transport.cc',
         'sidechain.cc',
         'slave.cc',
+        'slavable.cc',
         'slavable_automation_control.cc',
         'smf_source.cc',
         'sndfile_helpers.cc',