MTCslave - use new timecode API
authorRobin Gareus <robin@gareus.org>
Sat, 13 Oct 2012 23:27:43 +0000 (23:27 +0000)
committerRobin Gareus <robin@gareus.org>
Sat, 13 Oct 2012 23:27:43 +0000 (23:27 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@13267 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/ardour/ardour/slave.h
libs/ardour/mtc_slave.cc

index 48da6954176eac3fc4d6c89e79c0742ac311e856..0ba06b3ba58287b6fdf4b53564674ff554556d5f 100644 (file)
@@ -287,6 +287,7 @@ class MTC_Slave : public TimecodeSlave {
        double         quarter_frame_duration;
        Timecode::TimecodeFormat mtc_timecode;
        Timecode::TimecodeFormat a3e_timecode;
+       Timecode::Time timecode;
        bool           printed_timecode_warning;
 
        /* DLL - chase MTC */
index c568cd5d6a461bc6f0e7fc4a4ffe3a25e83dd910..9e51a9ca24cb43c05176c8f0c187743c9ed186f9 100644 (file)
@@ -281,7 +281,6 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
        */
 
        //DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC::update_mtc_time - TID:%1\n", ::pthread_self()));
-       Time timecode;
        TimecodeFormat tc_format;
        bool reset_tc = true;
 
@@ -370,7 +369,12 @@ MTC_Slave::update_mtc_time (const byte *msg, bool was_full, framepos_t now)
        */
 
        quarter_frame_duration = (double(session.frame_rate()) / (double) timecode.rate / 4.0);
-       session.timecode_to_sample (timecode, mtc_frame, true, false); // audio-frame according to Ardour's FPS
+
+       Timecode::timecode_to_sample (timecode, mtc_frame, true, false,
+               double(session.frame_rate()),
+               session.config.get_subframes_per_frame(),
+               session.config.get_timecode_offset_negative(), session.config.get_timecode_offset()
+               );
 
        DEBUG_TRACE (DEBUG::MTC, string_compose ("MTC at %1 TC %2 = mtc_frame %3 (from full message ? %4) tc-ratio %5\n",
                                                 now, timecode, mtc_frame, was_full, speedup_due_to_tc_mismatch));
@@ -630,5 +634,10 @@ MTC_Slave::apparent_timecode_format () const
 std::string 
 MTC_Slave::approximate_current_position() const
 {
-       return "88:88:88:88";
+       SafeTime last;
+       read_current (&last);
+       return Timecode::timecode_format_sampletime(
+               last.position,
+               double(session.frame_rate()),
+               25, false);
 }