summaryrefslogtreecommitdiff
path: root/libs/ardour/session_transport.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/session_transport.cc')
-rw-r--r--libs/ardour/session_transport.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc
index 4e93565f11..1c9293c760 100644
--- a/libs/ardour/session_transport.cc
+++ b/libs/ardour/session_transport.cc
@@ -1543,6 +1543,13 @@ Session::reset_rf_scale (framecnt_t motion)
}
void
+Session::mtc_status_changed (bool yn)
+{
+ g_atomic_int_set (&_mtc_active, yn);
+ MTCSyncStateChanged( yn );
+}
+
+void
Session::use_sync_source (Slave* new_slave)
{
/* Runs in process() context */
@@ -1554,6 +1561,18 @@ Session::use_sync_source (Slave* new_slave)
delete _slave;
_slave = new_slave;
+ MTC_Slave* mtc_slave = dynamic_cast<MTC_Slave*>(_slave);
+ if (mtc_slave) {
+ mtc_slave->ActiveChanged.connect_same_thread (mtc_status_connection, boost::bind (&Session::mtc_status_changed, this, _1));
+ MTCSyncStateChanged(mtc_slave->locked() );
+ } else {
+ if (g_atomic_int_get (&_mtc_active) ){
+ g_atomic_int_set (&_mtc_active, 0);
+ MTCSyncStateChanged( false );
+ }
+ mtc_status_connection.disconnect ();
+ }
+
DEBUG_TRACE (DEBUG::Slave, string_compose ("set new slave to %1\n", _slave));
// need to queue this for next process() cycle