diff options
author | Robin Gareus <robin@gareus.org> | 2012-10-28 10:48:06 +0000 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2012-10-28 10:48:06 +0000 |
commit | 52423fa8c3a460c5057b560121a84758f108a17c (patch) | |
tree | 4ad5fbf5b3764c57ca872314ac268c8189ca2b7c /libs/ardour | |
parent | f750aa32070b128f5e61e5abc39855f8654fb0de (diff) |
LTC (slave&gen): no reset on graph-change
fixes issues with transport stop/start
when making connections with jack1 while slaved to LTC
git-svn-id: svn://localhost/ardour2/branches/3.0@13356 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/slave.h | 1 | ||||
-rw-r--r-- | libs/ardour/ltc_slave.cc | 22 | ||||
-rw-r--r-- | libs/ardour/session_ltc.cc | 24 |
4 files changed, 32 insertions, 16 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index 5ef7d21bda..f359411846 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -1207,6 +1207,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void ltc_tx_initialize(); void ltc_tx_cleanup(); void ltc_tx_reset(); + void ltc_tx_resync_latency(); void ltc_tx_recalculate_position(); void ltc_tx_send_time_code_for_cycle (framepos_t, framepos_t, double, double, pframes_t nframes); #endif diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index 0ff1da7884..f864bee636 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -356,6 +356,7 @@ public: bool detect_ltc_fps(int, bool); bool equal_ltc_frame_time(LTCFrame *a, LTCFrame *b); void reset(); + void resync_latency(); Session& session; bool did_reset_tc_format; diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc index 12386eeb18..4f6f77ce1f 100644 --- a/libs/ardour/ltc_slave.cc +++ b/libs/ardour/ltc_slave.cc @@ -61,8 +61,8 @@ LTC_Slave::LTC_Slave (Session& s) decoder = ltc_decoder_create((int) frames_per_ltc_frame, 128 /*queue size*/); reset(); - session.Xrun.connect_same_thread (port_connections, boost::bind (<C_Slave::reset, this)); - session.engine().GraphReordered.connect_same_thread (port_connections, boost::bind (<C_Slave::reset, this)); + session.Xrun.connect_same_thread (port_connections, boost::bind (<C_Slave::resync_latency, this)); + session.engine().GraphReordered.connect_same_thread (port_connections, boost::bind (<C_Slave::resync_latency, this)); } LTC_Slave::~LTC_Slave() @@ -95,6 +95,18 @@ LTC_Slave::ok() const } void +LTC_Slave::resync_latency() +{ + DEBUG_TRACE (DEBUG::LTC, "LTC resync()\n"); + engine_dll_initstate = 0; + + if (session.ltc_output_io()) { /* check if Port exits */ + boost::shared_ptr<Port> ltcport = session.ltc_input_port(); + ltcport->get_connected_latency_range(ltc_slave_latency, false); + } +} + +void LTC_Slave::reset() { DEBUG_TRACE (DEBUG::LTC, "LTC reset()\n"); @@ -103,11 +115,7 @@ LTC_Slave::reset() transport_direction = 0; ltc_speed = 0; engine_dll_initstate = 0; - - if (session.ltc_output_io()) { /* check if Port exits */ - boost::shared_ptr<Port> ltcport = session.ltc_input_port(); - ltcport->get_connected_latency_range(ltc_slave_latency, false); - } + resync_latency(); } void diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc index dd2ddb5692..b7044d28a4 100644 --- a/libs/ardour/session_ltc.cc +++ b/libs/ardour/session_ltc.cc @@ -58,8 +58,8 @@ Session::ltc_tx_initialize() ltc_enc_buf = (ltcsnd_sample_t*) calloc((nominal_frame_rate() / 23), sizeof(ltcsnd_sample_t)); ltc_speed = 0; ltc_tx_reset(); - Xrun.connect_same_thread (*this, boost::bind (&Session::ltc_tx_reset, this)); - engine().GraphReordered.connect_same_thread (*this, boost::bind (&Session::ltc_tx_reset, this)); + Xrun.connect_same_thread (*this, boost::bind (&Session::ltc_tx_resync_latency, this)); + engine().GraphReordered.connect_same_thread (*this, boost::bind (&Session::ltc_tx_resync_latency, this)); } void @@ -72,6 +72,18 @@ Session::ltc_tx_cleanup() } void +Session::ltc_tx_resync_latency() +{ + DEBUG_TRACE (DEBUG::LTC, "LTC TX resync latency\n"); + if (!deletion_in_progress()) { + boost::shared_ptr<Port> ltcport = ltc_output_port(); + if (ltcport) { + ltcport->get_connected_latency_range(ltc_out_latency, true); + } + } +} + +void Session::ltc_tx_reset() { DEBUG_TRACE (DEBUG::LTC, "LTC TX reset\n"); @@ -80,13 +92,7 @@ Session::ltc_tx_reset() ltc_buf_off = 0; ltc_enc_byte = 0; ltc_enc_cnt = 0; - - if (!deletion_in_progress()) { - boost::shared_ptr<Port> ltcport = ltc_output_port(); - if (ltcport) { - ltcport->get_connected_latency_range(ltc_out_latency, true); - } - } + ltc_tx_resync_latency(); } void |