at transport stop, clear all existing automation watches (touch)

This commit is contained in:
Paul Davis 2017-01-23 13:25:24 +01:00
parent 4333a80cb2
commit 93192705bd
3 changed files with 28 additions and 0 deletions

View File

@ -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<ARDOUR::AutomationControl>);
void remove_automation_watch (boost::shared_ptr<ARDOUR::AutomationControl>);
void transport_stop_automation_watches (ARDOUR::framepos_t);
void set_session (ARDOUR::Session*);
gint timer ();

View 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 ()
{

View File

@ -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 */