From 0532e2063b73ec32d4dd108b58e90a0f20ae91b3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 13 Jul 2012 21:05:45 +0000 Subject: 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 --- libs/ardour/automatable.cc | 60 ++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 29 deletions(-) (limited to 'libs/ardour/automatable.cc') 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(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 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 c = control (param, true); - boost::shared_ptr l = boost::dynamic_pointer_cast(c->list()); + boost::shared_ptr 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 c = control(param); - boost::shared_ptr l = boost::dynamic_pointer_cast(c->list()); - + boost::shared_ptr 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 c = control(param, true); - boost::shared_ptr l = boost::dynamic_pointer_cast(c->list()); + boost::shared_ptr 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 c + = boost::dynamic_pointer_cast(li->second); + if (c) { + boost::shared_ptr l + = boost::dynamic_pointer_cast(c->list()); - for (Controls::iterator i = controls().begin(); i != controls().end(); ++i) { - boost::shared_ptr c - = boost::dynamic_pointer_cast(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; } } -- cgit v1.2.3