summaryrefslogtreecommitdiff
path: root/libs/ardour/automation_control.cc
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-09-19 00:47:49 +0000
committerDavid Robillard <d@drobilla.net>2008-09-19 00:47:49 +0000
commitd357eca668044badcb4bab318e2e74cfffa9a0b0 (patch)
treeeab9bf33b194f9e37c20f84375e5caa748ee994a /libs/ardour/automation_control.cc
parent3d976c5b727e4d55ce439b1d7c055a814477fa1a (diff)
Factor out sequencing related things into an independant new library: "evoral".
Anything related to the storage of events/values over a range of time lives in evoral. This includes MidiModel (Evoral::Sequence) and automation data (AutomationList (Evoral::ControlList), Automatable (Evoral::ControlSet), etc). libs/evoral synced with http://svn.drobilla.net/lad/trunk/evoral r1511. git-svn-id: svn://localhost/ardour2/branches/3.0@3754 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/automation_control.cc')
-rw-r--r--libs/ardour/automation_control.cc41
1 files changed, 9 insertions, 32 deletions
diff --git a/libs/ardour/automation_control.cc b/libs/ardour/automation_control.cc
index 4885a6fed9..a16306838a 100644
--- a/libs/ardour/automation_control.cc
+++ b/libs/ardour/automation_control.cc
@@ -30,10 +30,9 @@ using namespace PBD;
AutomationControl::AutomationControl(Session& session, boost::shared_ptr<AutomationList> list, string name)
- : Controllable((name == "unnamed controllable") ? list->parameter().to_string() : name)
+ : Controllable((name == "unnamed controllable") ? list->parameter().symbol() : name)
+ , Evoral::Control(list)
, _session(session)
- , _list(list)
- , _user_value(list->default_value())
{
}
@@ -43,49 +42,27 @@ AutomationControl::AutomationControl(Session& session, boost::shared_ptr<Automat
float
AutomationControl::get_value() const
{
- if (_list->automation_playback())
- return _list->eval(_session.transport_frame());
- else
- return _user_value;
+ bool from_list = ((AutomationList*)_list.get())->automation_playback();
+ return Control::get_value(from_list, _session.transport_frame());
}
void
AutomationControl::set_value(float value)
{
- _user_value = value;
+ bool to_list = _session.transport_stopped()
+ && ((AutomationList*)_list.get())->automation_playback();
- if (_session.transport_stopped() && _list->automation_write())
- _list->add(_session.transport_frame(), value);
+ Control::set_value(value, to_list, _session.transport_frame());
Changed(); /* EMIT SIGNAL */
}
-/** Get the latest user-set value, which may not equal get_value() when automation
- * is playing back, etc.
- *
- * Automation write/touch works by periodically sampling this value and adding it
- * to the AutomationList.
- */
-float
-AutomationControl::user_value() const
-{
- return _user_value;
-}
-
-
void
-AutomationControl::set_list(boost::shared_ptr<ARDOUR::AutomationList> list)
+AutomationControl::set_list(boost::shared_ptr<Evoral::ControlList> list)
{
- _list = list;
- _user_value = list->default_value();
+ Control::set_list(list);
Changed(); /* EMIT SIGNAL */
}
-
-Parameter
-AutomationControl::parameter() const
-{
- return _list->parameter();
-}