summaryrefslogtreecommitdiff
path: root/libs/ardour/session_ltc.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2012-11-17 20:15:41 +0000
committerRobin Gareus <robin@gareus.org>2012-11-17 20:15:41 +0000
commit3b63eae41d949123f4845fe92c8e9d28bb36aa59 (patch)
tree96e1399ec8ddfb92ea57bb07cd3e59943b542108 /libs/ardour/session_ltc.cc
parent4c5ef5318edb4e1cdc76288860c27358155efe17 (diff)
update to libltc-1.1.0
add support for TV standard specific offset and binary-group-flags git-svn-id: svn://localhost/ardour2/branches/3.0@13514 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_ltc.cc')
-rw-r--r--libs/ardour/session_ltc.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc
index 733ca6877e..93368d6e61 100644
--- a/libs/ardour/session_ltc.cc
+++ b/libs/ardour/session_ltc.cc
@@ -56,7 +56,11 @@ using namespace Timecode;
* This filter is adaptive so that fast vari-speed signals
* will not be affected by it.
*/
-#define LTC_RISE_TIME(speed) MIN (100, MAX(25, (4000000 / ((speed==0)?1:speed) / engine().frame_rate())))
+#define LTC_RISE_TIME(speed) MIN (100, MAX(40, (4000000 / ((speed==0)?1:speed) / engine().frame_rate())))
+
+#define TV_STANDARD(tcf) \
+ (timecode_to_frames_per_second(tcf)==25.0 ? LTC_TV_625_50 : \
+ timecode_has_drop_frames(tcf)? LTC_TV_525_60 : LTC_TV_FILM_24)
void
Session::ltc_tx_initialize()
@@ -67,7 +71,7 @@ Session::ltc_tx_initialize()
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX init sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(ltc_enc_tcformat)));
ltc_encoder = ltc_encoder_create(nominal_frame_rate(),
timecode_to_frames_per_second(ltc_enc_tcformat),
- -2);
+ TV_STANDARD(ltc_enc_tcformat), 0);
ltc_encoder_set_bufsize(ltc_encoder, nominal_frame_rate(), 23.0);
ltc_encoder_set_filter(ltc_encoder, LTC_RISE_TIME(1.0));
@@ -208,7 +212,10 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
TimecodeFormat cur_timecode = config.get_timecode_format();
if (cur_timecode != ltc_enc_tcformat) {
DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX1: TC format mismatch - reinit sr: %1 fps: %2\n", nominal_frame_rate(), timecode_to_frames_per_second(cur_timecode)));
- if (ltc_encoder_reinit(ltc_encoder, nominal_frame_rate(), timecode_to_frames_per_second(cur_timecode), -2)) {
+ if (ltc_encoder_reinit(ltc_encoder, nominal_frame_rate(),
+ timecode_to_frames_per_second(cur_timecode),
+ TV_STANDARD(cur_timecode), 0
+ )) {
PBD::error << _("LTC encoder: invalid framerate - LTC encoding is disabled for the remainder of this session.") << endmsg;
ltc_tx_cleanup();
return;
@@ -238,6 +245,9 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end
*/
framepos_t cycle_start_frame = (current_speed < 0) ? (start_frame - ltc_out_latency.max) : (start_frame + ltc_out_latency.max);
+ /* LTC TV standard offset */
+ cycle_start_frame += ltc_frame_alignment(nominal_frame_rate(), TV_STANDARD(cur_timecode));
+
/* cycle-start may become negative due to latency compensation */
if (cycle_start_frame < 0) { cycle_start_frame = 0; }