Remove unused API and a never used execution-branch
[ardour.git] / libs / ardour / automation_watch.cc
index 6ebf1aab71fd4808997c9cc22c7302e7439ab4c6..21d1b6a49d18b92dff060cefd01957b5517d684b 100644 (file)
@@ -111,6 +111,30 @@ AutomationWatch::remove_automation_watch (boost::shared_ptr<AutomationControl> a
        ac->list()->set_in_write_pass (false);
 }
 
+void
+AutomationWatch::transport_stop_automation_watches (framepos_t when)
+{
+       DEBUG_TRACE (DEBUG::Automation, "clear all automation watches\n");
+
+       AutomationWatches tmp;
+
+       {
+               Glib::Threads::Mutex::Lock lm (automation_watch_lock);
+               /* copy automation watches */
+               tmp = automation_watches;
+               /* clear existing container so that each
+                  ::remove_automation_watch() call from
+                  AutomationControl::stop_touch() is faster.
+               */
+
+               automation_watches.clear ();
+       }
+
+       for (AutomationWatches::iterator i = tmp.begin(); i != tmp.end(); ++i) {
+               (*i)->stop_touch (true, when);
+       }
+}
+
 gint
 AutomationWatch::timer ()
 {
@@ -125,7 +149,12 @@ AutomationWatch::timer ()
                if (time > _last_time) {  //we only write automation in the forward direction; this fixes automation-recording in a loop
                        for (AutomationWatches::iterator aw = automation_watches.begin(); aw != automation_watches.end(); ++aw) {
                                if ((*aw)->alist()->automation_write()) {
-                                       (*aw)->list()->add (time, (*aw)->user_double(), true);
+                                       double val = (*aw)->user_double();
+                                       boost::shared_ptr<SlavableAutomationControl> sc = boost::dynamic_pointer_cast<SlavableAutomationControl> (*aw);
+                                       if (sc) {
+                                               val = sc->reduce_by_masters (val, true);
+                                       }
+                                       (*aw)->list()->add (time, val, true);
                                }
                        }
                } else if (time != _last_time) {  //transport stopped or reversed.  stop the automation pass and start a new one (for bonus points, someday store the previous pass in an undo record)
@@ -135,7 +164,7 @@ AutomationWatch::timer ()
                                                                                (*aw)->alist()->automation_write()));
                                (*aw)->list()->set_in_write_pass (false);
                                if ( (*aw)->alist()->automation_write() ) {
-                                       (*aw)->list()->set_in_write_pass (true);
+                                       (*aw)->list()->set_in_write_pass (true, time);
                                }
                        }
                }