rearrange inheritance so that Automatable IS-A Slavable
Share assign code via Slavable; add visibility tags to Slavable+SlavableAutomationControl
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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&,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user