View Issue Details

IDProjectCategoryView StatusLast Update
0005066ardourbugspublic2012-10-13 23:40
Reporterx42 Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Target Version3.0 
Summary0005066: timecode clock display is off - it shows new SMPTE frame too early
DescriptionArdour's SMPTE clock display is not accurate (but close).

SMPTE frames switches 9 audio-frames to early @48KHz, 25fps ; 8 audio-frames too early @48Khz, 30fps;...

at 48KSPS the clock says 00.00.01.00 after 47990 audio-samples (both with internal clock as well with JACK-transport sync).

This affects the big-clock as well as the primary clock. The playhead, time-line and audio are accurate. see image.
Additional Informationa3-svn-13084
TagsNo tags attached.

Activities

2012-08-05 17:47

 

a3clock.png (90,042 bytes)   
a3clock.png (90,042 bytes)   

x42

2012-08-06 13:12

administrator   ~0013964

Last edited: 2012-08-06 21:57

tracked it down to libs/ardour/session_time.cc Session::sample_to_timecode().

Possible solutions: remove the code marked as "Not sure if this is necessary anymore..." (line 313 ff) and/or change the "rint" to "floor" in line 313:

timecode.subframes = (int32_t) rint(timecode_frames_fraction * config.get_subframes_per_frame());
                               ^^^^


I don't know enough about how and where subframes are used in A3 to decide on the proper solution.

debug-log created with attached patch @ 48KSPS, 25 fps
DEBUG::Transport: TC when: 47990
DEBUG::Transport: TC EXACT: 24.9948 (subframes: 99/100) FPS: 25
DEBUG::Transport: TC EXACT: 24.9948 -> FL 24
DEBUG::Transport: TC when: 47992
DEBUG::Transport: TC EXACT: 24.9958 (subframes: 100/100) FPS: 25
DEBUG::Transport: TC round up !!
DEBUG::Transport: TC EXACT: 25 -> FL 25


2012-08-06 13:12

 

a3_TCdebug5066__svn13106.diff (1,872 bytes)   
diff --git a/libs/ardour/session_time.cc b/libs/ardour/session_time.cc
index 42ae315..7ff6024 100644
--- a/libs/ardour/session_time.cc
+++ b/libs/ardour/session_time.cc
@@ -34,6 +34,7 @@
 
 #include "ardour/session.h"
 #include "ardour/tempo.h"
+#include "ardour/debug.h"
 
 #include "i18n.h"
 
@@ -307,21 +308,31 @@ Session::sample_to_timecode (framepos_t sample, Timecode::Time& timecode, bool u
 	timecode.hours = offset_sample / _frames_per_hour;
 	offset_sample = offset_sample % _frames_per_hour;
 
+	DEBUG_TRACE (DEBUG::Transport, string_compose ("TC when: %1\n", offset_sample));
+
 	// Calculate exact number of (exceeding) timecode frames and fractional frames
 	timecode_frames_left_exact = (double) offset_sample / _frames_per_timecode_frame;
 	timecode_frames_fraction = timecode_frames_left_exact - floor( timecode_frames_left_exact );
 	timecode.subframes = (int32_t) rint(timecode_frames_fraction * config.get_subframes_per_frame());
 
+	DEBUG_TRACE (DEBUG::Transport, string_compose ("TC EXACT: %1 (subframes: %2/%3) FPS: %4\n",
+				timecode_frames_left_exact,
+				timecode.subframes, config.get_subframes_per_frame(),
+				timecode_frames_per_second ()));
+
 	// XXX Not sure if this is necessary anymore...
 	if (timecode.subframes == config.get_subframes_per_frame()) {
 		// This can happen with 24 fps (and 29.97 fps ?)
 		timecode_frames_left_exact = ceil( timecode_frames_left_exact );
 		timecode.subframes = 0;
+		DEBUG_TRACE (DEBUG::Transport, "TC round up !!\n");
 	}
 
 	// Extract hour-exceeding frames for minute, second and frame calculations
 	timecode_frames_left = (uint32_t) floor (timecode_frames_left_exact);
 
+	DEBUG_TRACE (DEBUG::Transport, string_compose ("TC EXACT: %1 -> FL %2\n", timecode_frames_left_exact, timecode_frames_left));
+
 	if (timecode_drop_frames()) {
 		// See int32_t explanation in timecode_to_sample()...
 
a3_TCdebug5066__svn13106.diff (1,872 bytes)   

x42

2012-10-13 23:37

administrator   ~0014052

fixed as part of 13266

x42

2012-10-13 23:40

administrator   ~0014053

fixed in rev13266

Issue History

Date Modified Username Field Change
2012-08-05 17:47 x42 New Issue
2012-08-05 17:47 x42 File Added: a3clock.png
2012-08-05 22:41 cth103 cost => 0.00
2012-08-05 22:41 cth103 Target Version => 3.0
2012-08-06 13:12 x42 Note Added: 0013964
2012-08-06 13:12 x42 File Added: a3_TCdebug5066__svn13106.diff
2012-08-06 21:57 x42 Note Edited: 0013964
2012-10-13 23:37 x42 Note Added: 0014052
2012-10-13 23:40 x42 Note Added: 0014053
2012-10-13 23:40 x42 Status new => closed
2012-10-13 23:40 x42 Resolution open => fixed