summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2020-05-08 23:42:30 +0200
committerRobin Gareus <robin@gareus.org>2020-05-08 23:51:40 +0200
commitecd55f9fec0dda36b28393cdb33c7daa9e551da9 (patch)
tree61160d14987f58ccc8711d1ac984ee029e2fd569 /libs
parenta2094d97ad17d97aca3acef4aad19ecfcbe5138d (diff)
LTC Slave: subscribe to LatencyUpdated signal
This uses a recently introduce Signal instead of the generic GraphReordered, which was used in the past since it usually happened after the latency was changed.
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/transport_master.h6
-rw-r--r--libs/ardour/ltc_slave.cc24
2 files changed, 18 insertions, 12 deletions
diff --git a/libs/ardour/ardour/transport_master.h b/libs/ardour/ardour/transport_master.h
index 902f4f6f72..9e745cbef5 100644
--- a/libs/ardour/ardour/transport_master.h
+++ b/libs/ardour/ardour/transport_master.h
@@ -610,7 +610,7 @@ private:
bool detect_ltc_fps (int, bool);
bool equal_ltc_sample_time (LTCFrame* a, LTCFrame* b);
void resync_xrun ();
- void resync_latency ();
+ void resync_latency (bool);
void parse_timecode_offset ();
void parameter_changed (std::string const& p);
@@ -635,8 +635,8 @@ private:
Timecode::TimecodeFormat a3e_timecode;
double samples_per_timecode_frame;
- PBD::ScopedConnectionList port_connections;
- PBD::ScopedConnection config_connection;
+ PBD::ScopedConnection port_connection;
+ PBD::ScopedConnectionList session_connections;
LatencyRange ltc_slave_latency;
};
diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc
index c265835c08..bc0a8fb724 100644
--- a/libs/ardour/ltc_slave.cc
+++ b/libs/ardour/ltc_slave.cc
@@ -66,10 +66,9 @@ LTC_TransportMaster::LTC_TransportMaster (std::string const & name)
{
memset (&prev_frame, 0, sizeof(LTCFrameExt));
- resync_latency();
+ resync_latency (false);
- AudioEngine::instance()->Xrun.connect_same_thread (port_connections, boost::bind (&LTC_TransportMaster::resync_xrun, this));
- AudioEngine::instance()->GraphReordered.connect_same_thread (port_connections, boost::bind (&LTC_TransportMaster::resync_latency, this));
+ AudioEngine::instance()->Xrun.connect_same_thread (port_connection, boost::bind (&LTC_TransportMaster::resync_xrun, this));
}
void
@@ -89,7 +88,7 @@ LTC_TransportMaster::create_port ()
void
LTC_TransportMaster::set_session (Session *s)
{
- config_connection.disconnect ();
+ session_connections.drop_connections();
_session = s;
if (_session) {
@@ -109,14 +108,15 @@ LTC_TransportMaster::set_session (Session *s)
parse_timecode_offset();
reset (true);
- _session->config.ParameterChanged.connect_same_thread (config_connection, boost::bind (&LTC_TransportMaster::parameter_changed, this, _1));
+ _session->config.ParameterChanged.connect_same_thread (session_connections, boost::bind (&LTC_TransportMaster::parameter_changed, this, _1));
+ _session->LatencyUpdated.connect_same_thread (session_connections, boost::bind (&LTC_TransportMaster::resync_latency, this, _1));
}
}
LTC_TransportMaster::~LTC_TransportMaster()
{
- port_connections.drop_connections();
- config_connection.disconnect();
+ port_connection.disconnect();
+ session_connections.drop_connections();
if (did_reset_tc_format) {
_session->config.set_timecode_format (saved_tc_format);
@@ -185,14 +185,20 @@ LTC_TransportMaster::resync_xrun()
}
void
-LTC_TransportMaster::resync_latency()
+LTC_TransportMaster::resync_latency (bool playback)
{
+ if (playback) {
+ return;
+ }
DEBUG_TRACE (DEBUG::LTC, "LTC resync_latency()\n");
- sync_lock_broken = false;
+ uint32_t old = ltc_slave_latency.max;
if (_port) {
_port->get_connected_latency_range (ltc_slave_latency, false);
}
+ if (old != ltc_slave_latency.max) {
+ sync_lock_broken = false;
+ }
}
void