Share assign code via Slavable; add visibility tags to Slavable+SlavableAutomationControl
#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;
/* 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&);
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);
public Monitorable,
public Automatable,
public RouteGroupMember,
- public Slavable,
public boost::enable_shared_from_this<Route>
{
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);
#include <boost/shared_ptr.hpp>
-#include <pbd/signals.h>
+#include "pbd/signals.h"
+
+#include "evoral/Parameter.hpp"
+
+#include "ardour/libardour_visibility.h"
class XMLNode;
class VCA;
class VCAManager;
+class AutomationControl;
-class Slavable
+class LIBARDOUR_API Slavable
{
public:
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;
#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&,
public Soloable,
public Muteable,
public Automatable,
- public Slavable,
public Recordable,
public Monitorable,
public boost::enable_shared_from_this<VCA> {
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;
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
{
#include "pbd/xml++.h"
#include "ardour/slavable.h"
+#include "ardour/slavable_automation_control.h"
#include "ardour/vca.h"
#include "ardour/vca_manager.h"
(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;
+}
+
_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
{