From 915797fd232bf09231ae0390795fad5c93283193 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 10 Oct 2012 20:37:56 +0000 Subject: [PATCH] MTC-slave: print error if framerate mismatch git-svn-id: svn://localhost/ardour2/branches/3.0@13231 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/slave.h | 4 ++++ libs/ardour/mtc_slave.cc | 30 ++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/slave.h b/libs/ardour/ardour/slave.h index be6b966560..8379c689ce 100644 --- a/libs/ardour/ardour/slave.h +++ b/libs/ardour/ardour/slave.h @@ -260,6 +260,10 @@ class MTC_Slave : public Slave { int busy_guard1; int busy_guard2; + TimecodeFormat mtc_timecode; + TimecodeFormat a3e_timecode; + bool printed_timecode_warning; + /* DLL - chase MTC */ double t0; ///< time at the beginning of the MTC quater frame double t1; ///< calculated end of the MTC quater frame diff --git a/libs/ardour/mtc_slave.cc b/libs/ardour/mtc_slave.cc index f5b70317dd..e46e9eb955 100644 --- a/libs/ardour/mtc_slave.cc +++ b/libs/ardour/mtc_slave.cc @@ -61,6 +61,10 @@ MTC_Slave::MTC_Slave (Session& s, MIDI::Port& p) last_mtc_fps_byte = session.get_mtc_timecode_bits (); + mtc_timecode = timecode_60; // track changes of MTC timecode + a3e_timecode = timecode_60; // track canges of Ardour's timecode + printed_timecode_warning = false; + reset (true); rebind (p); } @@ -332,11 +336,29 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now) } if (reset_tc) { - if (!did_reset_tc_format) { - saved_tc_format = session.config.get_timecode_format(); - did_reset_tc_format = true; + TimecodeFormat cur_timecode = session.config.get_timecode_format(); + if (0 /* TODO preferences */) { + /* enforce time-code */ + if (!did_reset_tc_format) { + saved_tc_format = cur_timecode; + did_reset_tc_format = true; + } + if (cur_timecode != tc_format) { + warning << _("Session and MTC framerate mismatch.") << endmsg; + } + session.config.set_timecode_format (tc_format); + } else { + /* only warn about TC mismatch */ + if (mtc_timecode != tc_format) printed_timecode_warning = false; + if (a3e_timecode != cur_timecode) printed_timecode_warning = false; + + if (cur_timecode != tc_format && ! printed_timecode_warning) { + warning << _("Session and MTC framerate mismatch.") << endmsg; + printed_timecode_warning = true; + } } - session.config.set_timecode_format (tc_format); + mtc_timecode = tc_format; + a3e_timecode = cur_timecode; } DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC at %1 TC %2 = mtc_frame %3 (from full message ? %4)\n",