From 10ef65b696492e5e6e9abe009f2e2c4a3af51994 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 7 Jul 2010 23:48:46 +0000 Subject: [PATCH] Transmit MTC on playhead drag, as per #3239. git-svn-id: svn://localhost/ardour2/branches/3.0@7389 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/editor_drag.cc | 4 +++- libs/ardour/ardour/session.h | 2 +- libs/ardour/session_midi.cc | 9 +++++---- libs/ardour/session_process.cc | 2 +- libs/ardour/session_transport.cc | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 2aaeaa1038..1921349893 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2138,7 +2138,9 @@ CursorDrag::motion (GdkEvent* event, bool) _editor->show_verbose_time_cursor (_cursor->current_frame, 10); if (_editor->session() && _item == &_editor->playhead_cursor->canvas_item) { - _editor->session()->send_mmc_locate (_editor->playhead_cursor->current_frame); + nframes64_t const f = _editor->playhead_cursor->current_frame; + _editor->session()->send_mmc_locate (f); + _editor->session()->send_full_time_code (f); } diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index a7c3aae7a7..890fde45e3 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -783,6 +783,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi boost::shared_ptr playlists; void send_mmc_locate (nframes64_t); + int send_full_time_code (nframes64_t); protected: friend class AudioEngine; @@ -1133,7 +1134,6 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi bool _send_timecode_update; ///< Flag to send a full frame (Timecode) MTC message this cycle - int send_full_time_code(nframes_t nframes); int send_midi_time_code_for_cycle(nframes_t nframes); nframes_t adjust_apparent_position (nframes_t frames); diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 109a2bb5bc..29040dc4df 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -345,9 +345,10 @@ Session::mmc_record_enable (MIDI::MachineControl &mmc, size_t trk, bool enabled) /** Send MTC Full Frame message (complete Timecode time) for the start of this cycle. * This resets the MTC code, the next quarter frame message that is sent will be * the first one with the beginning of this cycle as the new start point. + * @param t time to send. */ int -Session::send_full_time_code(nframes_t /*nframes*/) +Session::send_full_time_code (nframes64_t const t) { /* This function could easily send at a given frame offset, but would * that be useful? Does ardour do sub-block accurate locating? [DR] */ @@ -361,11 +362,11 @@ Session::send_full_time_code(nframes_t /*nframes*/) return 0; } - // Get timecode time for this transport frame - sample_to_timecode(_transport_frame, timecode, true /* use_offset */, false /* no subframes */); + // Get timecode time for the given time + sample_to_timecode (t, timecode, true /* use_offset */, false /* no subframes */); transmitting_timecode_time = timecode; - outbound_mtc_timecode_frame = _transport_frame; + outbound_mtc_timecode_frame = t; // I don't understand this bit yet.. [DR] if (((mtc_timecode_bits >> 5) != MIDI::MTC_25_FPS) && (transmitting_timecode_time.frames % 2)) { diff --git a/libs/ardour/session_process.cc b/libs/ardour/session_process.cc index d7e9b7c995..7b58739017 100644 --- a/libs/ardour/session_process.cc +++ b/libs/ardour/session_process.cc @@ -268,7 +268,7 @@ Session::process_with_events (nframes_t nframes) * on locates (and allow slow slaves to position and prepare for rolling) */ if (_send_timecode_update) { - send_full_time_code(nframes); + send_full_time_code (_transport_frame); } if (!process_can_proceed()) { diff --git a/libs/ardour/session_transport.cc b/libs/ardour/session_transport.cc index 1123a6038b..037d041895 100644 --- a/libs/ardour/session_transport.cc +++ b/libs/ardour/session_transport.cc @@ -562,7 +562,7 @@ Session::non_realtime_stop (bool abort, int on_entry, bool& finished) have_looped = false; - send_full_time_code (0); + send_full_time_code (_transport_frame); if ((ptw & PostTransportLocate) && get_record_enabled()) { /* capture start has been changed, so save pending state */