- /* map LTC timecode to session TC setting */
- framepos_t ltc_frame; ///< audio-frame corresponding to LTC frame
- Timecode::timecode_to_sample (timecode, ltc_frame, true, false,
- double(session.frame_rate()),
- session.config.get_subframes_per_frame(),
- timecode_negative_offset, timecode_offset
- );
+ samplepos_t ltc_sample; // audio-sample corresponding to position of LTC frame
+
+ if (_session && Config->get_use_session_timecode_format()) {
+ Timecode::timecode_to_sample (timecode, ltc_sample, true, false, (double)ENGINE->sample_rate(), _session->config.get_subframes_per_frame(), timecode_negative_offset, timecode_offset);
+ } else {
+ Timecode::timecode_to_sample (timecode, ltc_sample, true, false, (double)ENGINE->sample_rate(), 100, timecode_negative_offset, timecode_offset);
+ }
+
+ ltc_sample += ltc_slave_latency.max;
+
+ /* This LTC frame spans sample time between sample.off_start .. sample.off_end
+ *
+ * NOTE: these sample times are NOT the ones that LTC is representing. They are
+ * derived our own audioengine's monotonic audio clock.
+ *
+ * So we expect the next frame to span sample.off_end+1 and ... <don't care for now>.
+ * That isn't the time we will necessarily receive the LTC frame, but the decoder
+ * should tell us that its span begins there.
+ *
+ */
+
+ samplepos_t cur_timestamp = sample.off_end + 1;