summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-04-25 13:41:38 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:41 -0400
commitf485cfa324717f57b9f820f43f1b53307b96a8b9 (patch)
tree39ad198f588b521e748356809d255a3c4c6f4c08 /libs/ardour
parenteee3837245f570d36e5d4d92409660c8ff777b5b (diff)
rearrange inheritance so that Automatable IS-A Slavable
Share assign code via Slavable; add visibility tags to Slavable+SlavableAutomationControl
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/automatable.h21
-rw-r--r--libs/ardour/ardour/route.h4
-rw-r--r--libs/ardour/ardour/slavable.h15
-rw-r--r--libs/ardour/ardour/slavable_automation_control.h3
-rw-r--r--libs/ardour/ardour/vca.h5
-rw-r--r--libs/ardour/route.cc27
-rw-r--r--libs/ardour/slavable.cc57
-rw-r--r--libs/ardour/vca.cc55
8 files changed, 83 insertions, 104 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index c9e14cfae5..5f9f7d2b91 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -23,10 +23,15 @@
#include <map>
#include <set>
#include <string>
+
#include <boost/shared_ptr.hpp>
+
#include "pbd/signals.h"
+
#include "evoral/ControlSet.hpp"
+
#include "ardour/libardour_visibility.h"
+#include "ardour/slavable.h"
#include "ardour/types.h"
class XMLNode;
@@ -39,7 +44,7 @@ class AutomationControl;
/* The inherited ControlSet is virtual because AutomatableSequence inherits
* from this AND EvoralSequence, which is also a ControlSet
*/
-class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet
+class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable
{
public:
Automatable(Session&);
@@ -47,17 +52,17 @@ public:
virtual ~Automatable();
- boost::shared_ptr<Evoral::Control>
- control_factory(const Evoral::Parameter& id);
+ boost::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id);
- boost::shared_ptr<AutomationControl>
- automation_control (const Evoral::Parameter& id, bool create_if_missing=false);
+ boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) {
+ return automation_control (id, false);
+ }
- boost::shared_ptr<const AutomationControl>
- automation_control (const Evoral::Parameter& id) const;
+ boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id, bool create_if_missing);
+ boost::shared_ptr<const AutomationControl> automation_control (const Evoral::Parameter& id) const;
virtual void add_control(boost::shared_ptr<Evoral::Control>);
- virtual bool find_next_event(double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const;
+ virtual bool find_next_event (double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const;
void clear_controls ();
virtual void transport_located (framepos_t now);
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 52be8c94b4..2e2c1ccf72 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -91,7 +91,6 @@ class LIBARDOUR_API Route : public GraphNode,
public Monitorable,
public Automatable,
public RouteGroupMember,
- public Slavable,
public boost::enable_shared_from_this<Route>
{
public:
@@ -612,9 +611,6 @@ public:
virtual void set_block_size (pframes_t 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);
diff --git a/libs/ardour/ardour/slavable.h b/libs/ardour/ardour/slavable.h
index b0ef33e1b4..147f90fda0 100644
--- a/libs/ardour/ardour/slavable.h
+++ b/libs/ardour/ardour/slavable.h
@@ -26,7 +26,11 @@
#include <boost/shared_ptr.hpp>
-#include <pbd/signals.h>
+#include "pbd/signals.h"
+
+#include "evoral/Parameter.hpp"
+
+#include "ardour/libardour_visibility.h"
class XMLNode;
@@ -34,8 +38,9 @@ namespace ARDOUR {
class VCA;
class VCAManager;
+class AutomationControl;
-class Slavable
+class LIBARDOUR_API Slavable
{
public:
Slavable ();
@@ -47,14 +52,16 @@ class Slavable
void assign (boost::shared_ptr<VCA>);
void unassign (boost::shared_ptr<VCA>);
+ virtual boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) = 0;
+
static std::string xml_node_name;
/* signal sent VCAManager once assignment is possible */
static PBD::Signal1<void,VCAManager*> Assign;
protected:
- virtual int assign_controls (boost::shared_ptr<VCA>) = 0;
- virtual int unassign_controls (boost::shared_ptr<VCA>) = 0;
+ virtual int assign_controls (boost::shared_ptr<VCA>);
+ virtual int unassign_controls (boost::shared_ptr<VCA>);
private:
mutable Glib::Threads::RWLock master_lock;
diff --git a/libs/ardour/ardour/slavable_automation_control.h b/libs/ardour/ardour/slavable_automation_control.h
index 98745e025d..45b555595f 100644
--- a/libs/ardour/ardour/slavable_automation_control.h
+++ b/libs/ardour/ardour/slavable_automation_control.h
@@ -21,10 +21,11 @@
#define __ardour_slavable_automation_control_h__
#include "ardour/automation_control.h"
+#include "ardour/libardour_visibility.h"
namespace ARDOUR {
-class SlavableAutomationControl : public AutomationControl
+class LIBARDOUR_API SlavableAutomationControl : public AutomationControl
{
public:
SlavableAutomationControl(ARDOUR::Session&,
diff --git a/libs/ardour/ardour/vca.h b/libs/ardour/ardour/vca.h
index 926cd500e0..4225605f9b 100644
--- a/libs/ardour/ardour/vca.h
+++ b/libs/ardour/ardour/vca.h
@@ -46,7 +46,6 @@ class LIBARDOUR_API VCA : public Stripable,
public Soloable,
public Muteable,
public Automatable,
- public Slavable,
public Recordable,
public Monitorable,
public boost::enable_shared_from_this<VCA> {
@@ -132,10 +131,6 @@ class LIBARDOUR_API VCA : public Stripable,
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;
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index c36e501aef..a449540c6f 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -5444,33 +5444,6 @@ Route::slaved_to (boost::shared_ptr<VCA> vca) const
return _gain_control->slaved_to (vca->gain_control());
}
-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;
-}
-
-int
-Route::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;
-}
-
bool
Route::muted_by_others_soloing () const
{
diff --git a/libs/ardour/slavable.cc b/libs/ardour/slavable.cc
index 7a7b8e2919..4a759f5fef 100644
--- a/libs/ardour/slavable.cc
+++ b/libs/ardour/slavable.cc
@@ -26,6 +26,7 @@
#include "pbd/xml++.h"
#include "ardour/slavable.h"
+#include "ardour/slavable_automation_control.h"
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
@@ -127,3 +128,59 @@ Slavable::unassign (boost::shared_ptr<VCA> v)
(void) unassign_controls (v);
_masters.erase (v->number());
}
+
+int
+Slavable::assign_controls (boost::shared_ptr<VCA> vca)
+{
+ boost::shared_ptr<SlavableAutomationControl> slave;
+ boost::shared_ptr<AutomationControl> master;
+ AutomationType types[] = {
+ GainAutomation,
+ SoloAutomation,
+ MuteAutomation,
+ RecEnableAutomation,
+ MonitoringAutomation,
+ NullAutomation
+ };
+
+ for (uint32_t n = 0; types[n] != NullAutomation; ++n) {
+
+ slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n]));
+ master = vca->automation_control (types[n]);
+
+ if (slave && master) {
+ slave->add_master (master);
+ }
+ }
+
+ return 0;
+}
+
+int
+Slavable::unassign_controls (boost::shared_ptr<VCA> vca)
+{
+ boost::shared_ptr<SlavableAutomationControl> slave;
+ boost::shared_ptr<AutomationControl> master;
+ AutomationType types[] = {
+ GainAutomation,
+ SoloAutomation,
+ MuteAutomation,
+ RecEnableAutomation,
+ MonitoringAutomation,
+ NullAutomation
+ };
+
+ for (uint32_t n = 0; types[n] != NullAutomation; ++n) {
+
+ slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n]));
+ if (!vca) {
+ /* unassign from all */
+ slave->clear_masters ();
+ } else {
+ slave->remove_master (master);
+ }
+ }
+
+ return 0;
+}
+
diff --git a/libs/ardour/vca.cc b/libs/ardour/vca.cc
index 2d1fbdec8f..8227bf8749 100644
--- a/libs/ardour/vca.cc
+++ b/libs/ardour/vca.cc
@@ -161,61 +161,6 @@ VCA::clear_all_solo_state ()
_solo_control->clear_all_solo_state ();
}
-int
-VCA::assign_controls (boost::shared_ptr<VCA> vca)
-{
- boost::shared_ptr<SlavableAutomationControl> slave;
- boost::shared_ptr<AutomationControl> master;
- AutomationType types[] = {
- GainAutomation,
- SoloAutomation,
- MuteAutomation,
- RecEnableAutomation,
- MonitoringAutomation,
- NullAutomation
- };
-
- for (uint32_t n = 0; types[n] != NullAutomation; ++n) {
-
- slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n]));
- master = vca->automation_control (types[n]);
-
- if (slave && master) {
- slave->add_master (master);
- }
- }
-
- return 0;
-}
-
-int
-VCA::unassign_controls (boost::shared_ptr<VCA> vca)
-{
- boost::shared_ptr<SlavableAutomationControl> slave;
- boost::shared_ptr<AutomationControl> master;
- AutomationType types[] = {
- GainAutomation,
- SoloAutomation,
- MuteAutomation,
- RecEnableAutomation,
- MonitoringAutomation,
- NullAutomation
- };
-
- for (uint32_t n = 0; types[n] != NullAutomation; ++n) {
-
- slave = boost::dynamic_pointer_cast<SlavableAutomationControl> (automation_control (types[n]));
- if (!vca) {
- /* unassign from all */
- slave->clear_masters ();
- } else {
- slave->remove_master (master);
- }
- }
-
- return 0;
-}
-
MonitorState
VCA::monitoring_state () const
{