diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-13 00:35:42 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2012-04-13 00:35:42 +0000 |
commit | 13699251d95d4d1732c05e37038a675f64e2f63f (patch) | |
tree | eb3bc815f91d70b58b9a38fb4199085fe73dcd5e /libs/ardour | |
parent | d7595f71be052a6dc692053bdf13c06e3c80785f (diff) |
convert rec-enable control for a Track from PBD::COntrollable to ARDOUR::AutomatioNControl, and use in MCP
git-svn-id: svn://localhost/ardour2/branches/3.0@11956 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/amp.cc | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/automation_control.h | 6 | ||||
-rw-r--r-- | libs/ardour/ardour/track.h | 10 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 3 | ||||
-rw-r--r-- | libs/ardour/event_type_map.cc | 3 | ||||
-rw-r--r-- | libs/ardour/track.cc | 27 |
6 files changed, 33 insertions, 18 deletions
diff --git a/libs/ardour/amp.cc b/libs/ardour/amp.cc index b74a57dbce..24b2066ed5 100644 --- a/libs/ardour/amp.cc +++ b/libs/ardour/amp.cc @@ -47,6 +47,8 @@ Amp::Amp (Session& s) p.set_range (0, 1.99526231f, 1, false); boost::shared_ptr<AutomationList> gl (new AutomationList (p)); _gain_control = boost::shared_ptr<GainControl> (new GainControl (X_("gaincontrol"), s, this, p, gl)); + _gain_control->set_flags (Controllable::GainLike); + add_control(_gain_control); } diff --git a/libs/ardour/ardour/automation_control.h b/libs/ardour/ardour/automation_control.h index 9ad46c9090..2c15a1b1b0 100644 --- a/libs/ardour/ardour/automation_control.h +++ b/libs/ardour/ardour/automation_control.h @@ -38,9 +38,9 @@ class AutomationControl : public PBD::Controllable, public Evoral::Control { public: AutomationControl(ARDOUR::Session&, - const Evoral::Parameter& parameter, - boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(), - const std::string& name=""); + const Evoral::Parameter& parameter, + boost::shared_ptr<ARDOUR::AutomationList> l=boost::shared_ptr<ARDOUR::AutomationList>(), + const std::string& name=""); boost::shared_ptr<AutomationList> alist() const { return boost::dynamic_pointer_cast<AutomationList>(_list); diff --git a/libs/ardour/ardour/track.h b/libs/ardour/ardour/track.h index 587a8dcd1b..2ec1ed4fdd 100644 --- a/libs/ardour/ardour/track.h +++ b/libs/ardour/ardour/track.h @@ -102,7 +102,7 @@ class Track : public Route, public PublicDiskstream virtual int set_state (const XMLNode&, int version); static void zero_diskstream_id_in_xml (XMLNode&); - boost::shared_ptr<PBD::Controllable> rec_enable_control() { return _rec_enable_control; } + boost::shared_ptr<AutomationControl> rec_enable_control() { return _rec_enable_control; } bool record_enabled() const; void set_record_enabled (bool yn, void *src); @@ -201,13 +201,13 @@ class Track : public Route, public PublicDiskstream FreezeState state; }; - struct RecEnableControllable : public PBD::Controllable { - RecEnableControllable (Track&); + struct RecEnableControl : public AutomationControl { + RecEnableControl (boost::shared_ptr<Track> t); void set_value (double); double get_value (void) const; - Track& track; + boost::shared_ptr<Track> track; }; virtual void set_state_part_two () = 0; @@ -218,7 +218,7 @@ class Track : public Route, public PublicDiskstream void maybe_declick (BufferSet&, framecnt_t, int); - boost::shared_ptr<RecEnableControllable> _rec_enable_control; + boost::shared_ptr<RecEnableControl> _rec_enable_control; framecnt_t check_initial_delay (framecnt_t nframes, framecnt_t&); diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index b6ab07c743..3ebf5478e6 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -145,7 +145,8 @@ namespace ARDOUR { MidiSystemExclusiveAutomation, FadeInAutomation, FadeOutAutomation, - EnvelopeAutomation + EnvelopeAutomation, + RecEnableAutomation }; enum AutoState { diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index 4b21d32e58..7cf6045d86 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -159,6 +159,9 @@ EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const case PanFrontBackAutomation: case PanLFEAutomation: break; + case RecEnableAutomation: + /* default 0.0 - 1.0 is fine */ + break; case PluginAutomation: case SoloAutomation: case MuteAutomation: diff --git a/libs/ardour/track.cc b/libs/ardour/track.cc index 2ef3c85b4a..f7f0e6fdbe 100644 --- a/libs/ardour/track.cc +++ b/libs/ardour/track.cc @@ -44,7 +44,6 @@ Track::Track (Session& sess, string name, Route::Flag flag, TrackMode mode, Data , _saved_meter_point (_meter_point) , _mode (mode) , _monitoring (MonitorAuto) - , _rec_enable_control (new RecEnableControllable(*this)) { _freeze_record.state = NoFreeze; _declickable = true; @@ -64,6 +63,15 @@ Track::init () return -1; } + boost::shared_ptr<Route> rp (shared_from_this()); + boost::shared_ptr<Track> rt = boost::dynamic_pointer_cast<Track> (rp); + _rec_enable_control = boost::shared_ptr<RecEnableControl> (new RecEnableControl(rt)); + _rec_enable_control->set_flags (Controllable::Toggle); + + /* don't add rec_enable_control to controls because we don't want it to + * appear as an automatable parameter + */ + return 0; } @@ -195,23 +203,24 @@ Track::freeze_state() const return _freeze_record.state; } -Track::RecEnableControllable::RecEnableControllable (Track& s) - : Controllable (X_("recenable"), Controllable::Toggle), track (s) +Track::RecEnableControl::RecEnableControl (boost::shared_ptr<Track> t) + : AutomationControl (t->session(), RecEnableAutomation, boost::shared_ptr<AutomationList>(), X_("recenable")) + , track (t) { + boost::shared_ptr<AutomationList> gl(new AutomationList(Evoral::Parameter(RecEnableAutomation))); + set_list (gl); } void -Track::RecEnableControllable::set_value (double val) +Track::RecEnableControl::set_value (double val) { - bool bval = ((val >= 0.5) ? true: false); - track.set_record_enabled (bval, this); + track->set_record_enabled (val >= 0.5 ? true : false, this); } double -Track::RecEnableControllable::get_value (void) const +Track::RecEnableControl::get_value (void) const { - if (track.record_enabled()) { return 1.0; } - return 0.0; + return (track->record_enabled() ? 1.0 : 0.0); } bool |