+void
+Automatable::automation_snapshot (nframes_t now)
+{
+ if (_last_automation_snapshot > now || (now - _last_automation_snapshot) > _session.automation_interval()) {
+
+ for (Controls::iterator i = _controls.begin(); i != _controls.end(); ++i) {
+ if (i->second->list()->automation_write()) {
+ i->second->list()->rt_add (now, i->second->user_value());
+ }
+ }
+
+ _last_automation_snapshot = now;
+ }
+}
+
+void
+Automatable::transport_stopped (nframes_t now)
+{
+ for (Controls::iterator li = _controls.begin(); li != _controls.end(); ++li) {
+
+ boost::shared_ptr<AutomationControl> c = li->second;
+
+ c->list()->reposition_for_rt_add (now);
+
+ if (c->list()->automation_state() != Off) {
+ c->set_value(c->list()->eval(now));
+ }
+ }
+}
+
+/* FIXME: this probably doesn't belong here */
+boost::shared_ptr<AutomationControl>
+Automatable::control_factory(boost::shared_ptr<AutomationList> list)
+{
+ if (list->parameter().type() == MidiCCAutomation) {
+ // FIXME: this will die horribly if this is not a MidiTrack
+ return boost::shared_ptr<AutomationControl>(new MidiTrack::MidiControl((MidiTrack*)this, list));
+ } else {
+ return boost::shared_ptr<AutomationControl>(new AutomationControl(_session, list));
+ }
+}
+