diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-12 12:17:17 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:12 -0400 |
commit | 16dccfcb8af5eb3c5462ee6a7b3a00596fb8164e (patch) | |
tree | 32283e1eece72d69660f174cdd1a4e5e6e7469ef /libs/ardour/session_transport.cc | |
parent | 5c8c249db9436fe1741ebcce17b96fbb98bc418f (diff) |
Add some libardour support for indicating MTC active status.
The general design here is wrong, because it should be more general and cover all possible sync sources.
But it does work, it is used in Tracks, and my attempt to do it correctly revealed the problem to be
an EXTREMELY difficult design issue (as in: two weeks of work on it did not really solve the
fundamental issues with slave design).
So, here it is for now, c/o Grygorii
Diffstat (limited to 'libs/ardour/session_transport.cc')
-rw-r--r-- | libs/ardour/session_transport.cc | 19 |
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 |