From f974cd5401f8e042f7c221261c5ce18b9adb8859 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 29 Sep 2017 04:13:57 +0200 Subject: [PATCH] Update Timecode Generator/Slave alignment --- libs/ardour/ltc_slave.cc | 2 +- libs/ardour/session_ltc.cc | 9 ++++----- libs/ardour/session_midi.cc | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libs/ardour/ltc_slave.cc b/libs/ardour/ltc_slave.cc index a25eb41dd3..9baa3276ef 100644 --- a/libs/ardour/ltc_slave.cc +++ b/libs/ardour/ltc_slave.cc @@ -390,7 +390,7 @@ LTC_Slave::process_ltc(samplepos_t const /*now*/) timecode_negative_offset, timecode_offset ); - ltc_frame += ltc_slave_latency.max + session.worst_playback_latency(); + ltc_frame += ltc_slave_latency.max; samplepos_t cur_timestamp = sample.off_end + 1; DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC F: %1 LF: %2 N: %3 L: %4\n", ltc_frame, last_ltc_sample, cur_timestamp, last_timestamp)); diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc index 6b3d8b2174..5c4a65ad03 100644 --- a/libs/ardour/session_ltc.cc +++ b/libs/ardour/session_ltc.cc @@ -263,16 +263,15 @@ Session::ltc_tx_send_time_code_for_cycle (samplepos_t start_sample, samplepos_t * buffer. * * The timecode is generated directly in the Session process callback - * using _transport_sample. It requires that the session has set the - * port's playback latency to worst_playback_latency() prior to - * calling ltc_tx_send_time_code_for_cycle(). + * using _transport_sample (which is the audible frame at the + * output). */ samplepos_t cycle_start_sample; if (current_speed < 0) { - cycle_start_sample = (start_sample - ltc_out_latency.max + worst_playback_latency()); + cycle_start_sample = (start_sample + ltc_out_latency.max); } else if (current_speed > 0) { - cycle_start_sample = (start_sample + ltc_out_latency.max - worst_playback_latency()); + cycle_start_sample = (start_sample - ltc_out_latency.max); } else { /* There is no need to compensate for latency when not rolling * rather send the accurate NOW timecode diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index d4bb41b735..d0e75fbb6e 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -417,7 +417,7 @@ Session::send_full_time_code (samplepos_t const t, MIDI::pframes_t nframes) LatencyRange mtc_out_latency = {0, 0}; // TODO cache this, update on engine().GraphReordered() _midi_ports->mtc_output_port ()->get_connected_latency_range (ltc_out_latency, true); - sampleoffset_t mtc_offset = worst_playback_latency() - mtc_out_latency.max; + sampleoffset_t mtc_offset = mtc_out_latency.max; // only if rolling.. ? outbound_mtc_timecode_frame += mtc_offset; -- 2.30.2