LTC: break out xrun and latency callbacks.
prepare to call get_connected_latency_range() only if needed. git-svn-id: svn://localhost/ardour2/branches/3.0@13366 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
@@ -356,6 +356,7 @@ public:
|
||||
bool detect_ltc_fps(int, bool);
|
||||
bool equal_ltc_frame_time(LTCFrame *a, LTCFrame *b);
|
||||
void reset();
|
||||
void resync_xrun();
|
||||
void resync_latency();
|
||||
|
||||
Session& session;
|
||||
|
||||
@@ -61,7 +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::resync_latency, this));
|
||||
resync_latency();
|
||||
session.Xrun.connect_same_thread (port_connections, boost::bind (<C_Slave::resync_xrun, this));
|
||||
session.engine().GraphReordered.connect_same_thread (port_connections, boost::bind (<C_Slave::resync_latency, this));
|
||||
}
|
||||
|
||||
@@ -94,10 +95,17 @@ LTC_Slave::ok() const
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
LTC_Slave::resync_xrun()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::LTC, "LTC resync_xrun()\n");
|
||||
engine_dll_initstate = 0;
|
||||
}
|
||||
|
||||
void
|
||||
LTC_Slave::resync_latency()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::LTC, "LTC resync()\n");
|
||||
DEBUG_TRACE (DEBUG::LTC, "LTC resync_latency()\n");
|
||||
engine_dll_initstate = 0;
|
||||
|
||||
if (session.ltc_output_io()) { /* check if Port exits */
|
||||
@@ -115,7 +123,6 @@ LTC_Slave::reset()
|
||||
transport_direction = 0;
|
||||
ltc_speed = 0;
|
||||
engine_dll_initstate = 0;
|
||||
resync_latency();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -378,6 +385,9 @@ LTC_Slave::speed_and_position (double& speed, framepos_t& pos)
|
||||
* ..but first fix jack2 issue with re-computing latency
|
||||
* in the correct order. Until then, querying it in the
|
||||
* process-callback is the only way to get the current value
|
||||
*
|
||||
* update: fix for this issue is known -- common/JackEngine.cpp
|
||||
* but not yet applied to jack2 git.
|
||||
*/
|
||||
ltcport->get_connected_latency_range(ltc_slave_latency, false);
|
||||
#endif
|
||||
|
||||
@@ -58,7 +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_resync_latency, this));
|
||||
ltc_tx_resync_latency();
|
||||
Xrun.connect_same_thread (*this, boost::bind (&Session::ltc_tx_reset, this));
|
||||
engine().GraphReordered.connect_same_thread (*this, boost::bind (&Session::ltc_tx_resync_latency, this));
|
||||
}
|
||||
|
||||
@@ -92,7 +93,6 @@ Session::ltc_tx_reset()
|
||||
ltc_buf_off = 0;
|
||||
ltc_enc_byte = 0;
|
||||
ltc_enc_cnt = 0;
|
||||
ltc_tx_resync_latency();
|
||||
}
|
||||
|
||||
void
|
||||
@@ -160,6 +160,9 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
|
||||
* ..but first fix jack2 issue with re-computing latency
|
||||
* in the correct order. Until then, querying it in the
|
||||
* process-callback is the only way to get the current value
|
||||
*
|
||||
* update: fix for this issue is known -- common/JackEngine.cpp
|
||||
* but not yet applied to jack2 git.
|
||||
*/
|
||||
ltcport->get_connected_latency_range(ltc_out_latency, true);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user