diff options
author | Robin Gareus <robin@gareus.org> | 2012-10-26 03:11:12 +0000 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2012-10-26 03:11:12 +0000 |
commit | ccb64dc1df1d5e08bad7fe68bf7d6c0c5833d7c2 (patch) | |
tree | ae6ddacd1769441a84f2b41eca76f1cfe0535e46 /libs/ardour/session_ltc.cc | |
parent | 6f5384879c2aa4bc3be78a5a92e80777dfccd4ed (diff) |
LTC generator - prevent assert when framerate changes midway
git-svn-id: svn://localhost/ardour2/branches/3.0@13346 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/session_ltc.cc')
-rw-r--r-- | libs/ardour/session_ltc.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/ardour/session_ltc.cc b/libs/ardour/session_ltc.cc index 0cff7ef2b2..de85ed06d6 100644 --- a/libs/ardour/session_ltc.cc +++ b/libs/ardour/session_ltc.cc @@ -119,16 +119,16 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end } SyncSource sync_src = Config->get_sync_source(); - if (engine().freewheeling() || !Config->get_send_ltc() || + if (engine().freewheeling() || !Config->get_send_ltc() /* TODO * decide which time-sources we can generated LTC from. * Internal, JACK or sample-synced slaves should be fine. - * + * talk to oofus. * || (config.get_external_sync() && sync_src == LTC) || (config.get_external_sync() && sync_src == MTC) */ - (config.get_external_sync() && sync_src == MIDIClock) + ||(config.get_external_sync() && sync_src == MIDIClock) ) { return; } @@ -337,7 +337,7 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end // (4) check if alignment matches - const double fptcf = frames_per_timecode_frame(); // convenient, used a lot below. + const double fptcf = frames_per_timecode_frame(); /* maximum difference of bit alignment in audio-samples. * @@ -390,7 +390,11 @@ Session::ltc_tx_send_time_code_for_cycle (framepos_t start_frame, framepos_t end DEBUG_TRACE (DEBUG::LTC, string_compose("LTC TX4: now: %1 trs: %2 toff %3\n", cycle_start_frame, tc_sample_start, soff)); uint32_t cyc_off; - assert(soff >= 0 && soff < fptcf); + if (soff < 0 || soff >= fptcf) { + /* session framerate change between (2) and now */ + ltc_tx_reset(); + return; + } if (ltc_speed < 0 ) { /* calculate the byte that starts at or after the current position */ |