From 93192705bddab9392544d44278d63e4b83c68af2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 23 Jan 2017 13:25:24 +0100 Subject: [PATCH] at transport stop, clear all existing automation watches (touch) --- libs/ardour/ardour/automation_watch.h | 2 ++ libs/ardour/automation_watch.cc | 24 ++++++++++++++++++++++++ libs/ardour/session_transport.cc | 2 ++ 3 files changed, 28 insertions(+) diff --git a/libs/ardour/ardour/automation_watch.h b/libs/ardour/ardour/automation_watch.h index febbe10398..6822a38b4a 100644 --- a/libs/ardour/ardour/automation_watch.h +++ b/libs/ardour/ardour/automation_watch.h @@ -27,6 +27,7 @@ #include "pbd/signals.h" #include "ardour/session_handle.h" +#include "ardour/types.h" namespace ARDOUR { @@ -38,6 +39,7 @@ class LIBARDOUR_API AutomationWatch : public sigc::trackable, public ARDOUR::Ses void add_automation_watch (boost::shared_ptr); void remove_automation_watch (boost::shared_ptr); + void transport_stop_automation_watches (ARDOUR::framepos_t); void set_session (ARDOUR::Session*); gint timer (); diff --git a/libs/ardour/automation_watch.cc b/libs/ardour/automation_watch.cc index 4152c5d5b7..954b65120b 100644 --- a/libs/ardour/automation_watch.cc +++ b/libs/ardour/automation_watch.cc @@ -111,6 +111,30 @@ AutomationWatch::remove_automation_watch (boost::shared_ptr 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 () { diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 4a729700ab..4818cfaab3 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -37,6 +37,7 @@ #include "ardour/audioengine.h" #include "ardour/auditioner.h" +#include "ardour/automation_watch.h" #include "ardour/butler.h" #include "ardour/click.h" #include "ardour/debug.h" @@ -932,6 +933,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) PositionChanged (_transport_frame); /* EMIT SIGNAL */ DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC with speed = %1\n", _transport_speed)); TransportStateChange (); /* EMIT SIGNAL */ + AutomationWatch::instance().transport_stop_automation_watches (_transport_frame); /* and start it up again if relevant */ -- 2.30.2