monotonic_cnt = 0;
fps_detected=false;
- ltc_timecode = timecode_60; // track changes of LTC fps
- a3e_timecode = timecode_60; // track changes of Ardour's fps
+ ltc_timecode = session.config.get_timecode_format();
+ a3e_timecode = session.config.get_timecode_format();
printed_timecode_warning = false;
ltc_detect_fps_cnt = ltc_detect_fps_max = 0;
memset(&prev_frame, 0, sizeof(LTCFrameExt));
DEBUG_TRACE (DEBUG::LTC, "LTC resync_latency()\n");
engine_dll_initstate = 0;
- if (session.ltc_output_io()) { /* check if Port exits */
+ if (!session.deletion_in_progress() && 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);
}
}
ltc_detect_fps_cnt++;
- if (ltc_detect_fps_cnt > 40)
- {
- if (ltc_detect_fps_cnt > ltc_detect_fps_max
- && ( ceil(timecode.rate) != (ltc_detect_fps_max + 1)
- || timecode.drop != df
- )
- )
- {
- DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC detected FPS %1%2",
- ltc_detect_fps_max + 1, timecode.drop ? "df" : ""));
+ if (ltc_detect_fps_cnt > 40) {
+ if (ltc_detect_fps_cnt > ltc_detect_fps_max) {
detected_fps = ltc_detect_fps_max + 1;
if (df) {
/* LTC df -> indicates fractional framerate */
- detected_fps = detected_fps * 1000.0 / 1001.0;
+ if (Config->get_timecode_source_2997()) {
+ detected_fps = detected_fps * 999.0 / 1000.0;
+ } else {
+ detected_fps = detected_fps * 1000.0 / 1001.0;
+ }
+ }
+
+ if (timecode.rate != detected_fps || timecode.drop != df) {
+ DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC detected FPS: %1%2\n", detected_fps, df?"df":"ndf"));
+ } else {
+ detected_fps = 0; /* no cange */
}
- DEBUG_TRACE (DEBUG::LTC, string_compose ("LTC detected FPS: %1%2\n", detected_fps, df?"df":"ndf"));
}
ltc_detect_fps_cnt = ltc_detect_fps_max = 0;
}
/* poll and check session TC */
TimecodeFormat tc_format = apparent_timecode_format();
TimecodeFormat cur_timecode = session.config.get_timecode_format();
+
if (Config->get_timecode_sync_frame_rate()) {
/* enforce time-code */
if (!did_reset_tc_format) {
did_reset_tc_format = true;
}
if (cur_timecode != tc_format) {
- warning << string_compose(_("Session framerate adjusted from %1 to LTC's %2."),
- Timecode::timecode_format_name(cur_timecode),
- Timecode::timecode_format_name(tc_format))
- << endmsg;
+ if (ceil(Timecode::timecode_to_frames_per_second(cur_timecode)) != ceil(Timecode::timecode_to_frames_per_second(tc_format))) {
+ warning << string_compose(_("Session framerate adjusted from %1 to LTC's %2."),
+ Timecode::timecode_format_name(cur_timecode),
+ Timecode::timecode_format_name(tc_format))
+ << endmsg;
+ }
session.config.set_timecode_format (tc_format);
}
} else {
if (a3e_timecode != cur_timecode) printed_timecode_warning = false;
if (cur_timecode != tc_format && ! printed_timecode_warning) {
- warning << string_compose(_("Session and LTC framerate mismatch: LTC:%1 Session:%2."),
- Timecode::timecode_format_name(tc_format),
- Timecode::timecode_format_name(cur_timecode))
- << endmsg;
+ if (ceil(Timecode::timecode_to_frames_per_second(cur_timecode)) != ceil(Timecode::timecode_to_frames_per_second(tc_format))) {
+ warning << string_compose(_("Session and LTC framerate mismatch: LTC:%1 Session:%2."),
+ Timecode::timecode_format_name(tc_format),
+ Timecode::timecode_format_name(cur_timecode))
+ << endmsg;
+ }
printed_timecode_warning = true;
}
}
/* 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,
+ Timecode::timecode_to_sample (timecode, ltc_frame, false, false,
double(session.frame_rate()),
session.config.get_subframes_per_frame(),
session.config.get_timecode_offset_negative(), session.config.get_timecode_offset()
else if (timecode.rate == 25 && !timecode.drop)
return timecode_25;
else if (rint(timecode.rate * 100) == 2997 && !timecode.drop)
- return timecode_2997;
+ return (Config->get_timecode_source_2997() ? timecode_2997000 : timecode_2997);
else if (rint(timecode.rate * 100) == 2997 && timecode.drop)
- return timecode_2997drop;
+ return (Config->get_timecode_source_2997() ? timecode_2997000drop : timecode_2997drop);
else if (timecode.rate == 30 && timecode.drop)
return timecode_2997drop; // timecode_30drop; // LTC counting to 30 frames w/DF *means* 29.97 df
else if (timecode.rate == 30 && !timecode.drop)
LTC_Slave::approximate_current_position() const
{
if (last_timestamp == 0) {
- return " --:--:--:--";
+ return " \u2012\u2012:\u2012\u2012:\u2012\u2012:\u2012\u2012";
}
return Timecode::timecode_format_time(timecode);
}
std::string
LTC_Slave::approximate_current_delta() const
{
- char delta[24];
+ char delta[80];
if (last_timestamp == 0 || engine_dll_initstate == 0) {
snprintf(delta, sizeof(delta), "\u2012\u2012\u2012\u2012");
} else if ((monotonic_cnt - last_timestamp) > 2 * frames_per_ltc_frame) {
- snprintf(delta, sizeof(delta), "flywheel");
+ snprintf(delta, sizeof(delta), _("flywheel"));
} else {
- snprintf(delta, sizeof(delta), "%s%4" PRIi64 " sm",
+ snprintf(delta, sizeof(delta), "\u0394<span foreground=\"green\" face=\"monospace\" >%s%5" PRIi64 "</span>sm",
PLUSMINUS(-current_delta), abs(current_delta));
}
return std::string(delta);