summaryrefslogtreecommitdiff
path: root/libs/ardour/automatable.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-07-13 21:05:45 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-07-13 21:05:45 +0000
commit0532e2063b73ec32d4dd108b58e90a0f20ae91b3 (patch)
treef9728e4b57f260fd5d468a9c3dd2b2dd2d97e7d7 /libs/ardour/automatable.cc
parentb04cd7d7045dd40a1e3ae819ad3a2f9bb08a01f1 (diff)
dramatic overhaul of automation. too long to explain here. this work is not finished - write/touch passes do not correctly overwrite existing data because the semantics of ControlList::insert_iterator need clarification. more to follow
git-svn-id: svn://localhost/ardour2/branches/3.0@13038 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/automatable.cc')
-rw-r--r--libs/ardour/automatable.cc60
1 files changed, 31 insertions, 29 deletions
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index d0a605bcd9..608ae745de 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -47,14 +47,12 @@ const string Automatable::xml_node_name = X_("Automation");
Automatable::Automatable(Session& session)
: _a_session(session)
- , _last_automation_snapshot(0)
{
}
Automatable::Automatable (const Automatable& other)
: ControlSet (other)
, _a_session (other._a_session)
- , _last_automation_snapshot (0)
{
Glib::Mutex::Lock lm (other._control_lock);
@@ -63,6 +61,18 @@ Automatable::Automatable (const Automatable& other)
add_control (ac);
}
}
+
+Automatable::~Automatable ()
+{
+ {
+ Glib::Mutex::Lock lm (_control_lock);
+
+ for (Controls::const_iterator li = _controls.begin(); li != _controls.end(); ++li) {
+ boost::dynamic_pointer_cast<AutomationControl>(li->second)->drop_references ();
+ }
+ }
+}
+
int
Automatable::old_set_automation_state (const XMLNode& node)
{
@@ -74,8 +84,6 @@ Automatable::old_set_automation_state (const XMLNode& node)
warning << _("Automation node has no path property") << endmsg;
}
- _last_automation_snapshot = 0;
-
return 0;
}
@@ -102,8 +110,6 @@ Automatable::load_automation (const string& path)
set<Evoral::Parameter> tosave;
controls().clear ();
- _last_automation_snapshot = 0;
-
while (in) {
double when;
double value;
@@ -228,8 +234,6 @@ Automatable::set_automation_xml_state (const XMLNode& node, Evoral::Parameter le
}
}
- _last_automation_snapshot = 0;
-
return 0;
}
@@ -258,11 +262,10 @@ Automatable::set_parameter_automation_state (Evoral::Parameter param, AutoState
{
Glib::Mutex::Lock lm (control_lock());
- boost::shared_ptr<Evoral::Control> c = control (param, true);
- boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
+ boost::shared_ptr<AutomationControl> c = automation_control (param, true);
- if (s != l->automation_state()) {
- l->set_automation_state (s);
+ if (c && (s != c->automation_state())) {
+ c->set_automation_state (s);
_a_session.set_dirty ();
}
}
@@ -272,11 +275,10 @@ Automatable::get_parameter_automation_state (Evoral::Parameter param)
{
AutoState result = Off;
- boost::shared_ptr<Evoral::Control> c = control(param);
- boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
-
+ boost::shared_ptr<AutomationControl> c = automation_control(param);
+
if (c) {
- result = l->automation_state();
+ result = c->automation_state();
}
return result;
@@ -287,11 +289,10 @@ Automatable::set_parameter_automation_style (Evoral::Parameter param, AutoStyle
{
Glib::Mutex::Lock lm (control_lock());
- boost::shared_ptr<Evoral::Control> c = control(param, true);
- boost::shared_ptr<AutomationList> l = boost::dynamic_pointer_cast<AutomationList>(c->list());
+ boost::shared_ptr<AutomationControl> c = automation_control(param, true);
- if (s != l->automation_style()) {
- l->set_automation_style (s);
+ if (c && (s != c->automation_style())) {
+ c->set_automation_style (s);
_a_session.set_dirty ();
}
}
@@ -336,19 +337,20 @@ Automatable::protect_automation ()
}
void
-Automatable::automation_snapshot (framepos_t now, bool force)
+Automatable::transport_located (framepos_t now)
{
- if (force || _last_automation_snapshot > now || (now - _last_automation_snapshot) > _automation_interval) {
+ for (Controls::iterator li = controls().begin(); li != controls().end(); ++li) {
+
+ boost::shared_ptr<AutomationControl> c
+ = boost::dynamic_pointer_cast<AutomationControl>(li->second);
+ if (c) {
+ boost::shared_ptr<AutomationList> l
+ = boost::dynamic_pointer_cast<AutomationList>(c->list());
- for (Controls::iterator i = controls().begin(); i != controls().end(); ++i) {
- boost::shared_ptr<AutomationControl> c
- = boost::dynamic_pointer_cast<AutomationControl>(i->second);
- if (_a_session.transport_rolling() && c->automation_write()) {
- c->list()->rt_add (now, i->second->user_double());
+ if (l) {
+ l->start_write_pass (now);
}
}
-
- _last_automation_snapshot = now;
}
}