mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Update LTC reader port latency on connection change
This mechanism adds infrastructure that can later also be used for MTC and MIDIClock. PS. The LTC Generator port's latency is queried after the port is created, and later kept in sync via LatencyUpdated signal.
This commit is contained in:
parent
a46091b86a
commit
3ca33c07dc
4 changed files with 20 additions and 12 deletions
|
|
@ -443,9 +443,9 @@ protected:
|
|||
|
||||
XMLNode port_node;
|
||||
|
||||
PBD::ScopedConnection port_connection;
|
||||
bool connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
||||
virtual void connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn);
|
||||
|
||||
PBD::ScopedConnection port_connection;
|
||||
PBD::ScopedConnection backend_connection;
|
||||
|
||||
virtual void register_properties ();
|
||||
|
|
@ -613,6 +613,7 @@ private:
|
|||
void resync_latency (bool);
|
||||
void parse_timecode_offset ();
|
||||
void parameter_changed (std::string const& p);
|
||||
void connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string, boost::weak_ptr<ARDOUR::Port>, std::string, bool);
|
||||
|
||||
bool did_reset_tc_format;
|
||||
Timecode::TimecodeFormat saved_tc_format;
|
||||
|
|
|
|||
|
|
@ -66,9 +66,8 @@ LTC_TransportMaster::LTC_TransportMaster (std::string const & name)
|
|||
{
|
||||
memset (&prev_frame, 0, sizeof(LTCFrameExt));
|
||||
|
||||
resync_latency (false);
|
||||
|
||||
AudioEngine::instance()->Xrun.connect_same_thread (port_connection, boost::bind (<C_TransportMaster::resync_xrun, this));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -125,6 +124,18 @@ LTC_TransportMaster::~LTC_TransportMaster()
|
|||
ltc_decoder_free(decoder);
|
||||
}
|
||||
|
||||
void
|
||||
LTC_TransportMaster::connection_handler (boost::weak_ptr<ARDOUR::Port> w0, std::string n0, boost::weak_ptr<ARDOUR::Port> w1, std::string n1, bool con)
|
||||
{
|
||||
TransportMaster::connection_handler(w0, n0, w1, n1, con);
|
||||
|
||||
boost::shared_ptr<Port> p0 = w0.lock ();
|
||||
boost::shared_ptr<Port> p1 = w1.lock ();
|
||||
if (p0 == _port || p1 == _port) {
|
||||
resync_latency (false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LTC_TransportMaster::parse_timecode_offset()
|
||||
{
|
||||
|
|
@ -190,11 +201,11 @@ LTC_TransportMaster::resync_latency (bool playback)
|
|||
if (playback) {
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE (DEBUG::LTC, "LTC resync_latency()\n");
|
||||
|
||||
uint32_t old = ltc_slave_latency.max;
|
||||
if (_port) {
|
||||
_port->get_connected_latency_range (ltc_slave_latency, false);
|
||||
DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC resync_latency: %1\n", ltc_slave_latency.max));
|
||||
}
|
||||
if (old != ltc_slave_latency.max) {
|
||||
sync_lock_broken = false;
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ Session::ltc_tx_resync_latency (bool playback)
|
|||
if (deletion_in_progress() || !playback) {
|
||||
return;
|
||||
}
|
||||
DEBUG_TRACE (DEBUG::TXLTC, "resync latency\n");
|
||||
boost::shared_ptr<Port> ltcport = ltc_output_port();
|
||||
if (ltcport) {
|
||||
ltcport->get_connected_latency_range(ltc_out_latency, true);
|
||||
DEBUG_TRACE (DEBUG::TXLTC, string_compose ("resync latency: %1\n", ltc_out_latency.max));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -163,11 +163,11 @@ TransportMaster::set_name (std::string const & str)
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
void
|
||||
TransportMaster::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, boost::weak_ptr<ARDOUR::Port>, std::string name2, bool yn)
|
||||
{
|
||||
if (!_port) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string fqn = ARDOUR::AudioEngine::instance()->make_port_name_non_relative (_port->name());
|
||||
|
|
@ -188,11 +188,7 @@ TransportMaster::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string
|
|||
}
|
||||
|
||||
PropertyChanged (Properties::connected);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue