summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_drag.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-12-22 23:43:04 +0000
committerCarl Hetherington <carl@carlh.net>2010-12-22 23:43:04 +0000
commit95bb346926e237b903059c83a70e58ed9253eaca (patch)
tree6497d50a2556d2c11a7c61c8b6624c9451d66c13 /gtk2_ardour/editor_drag.cc
parentd83219706fe8d3f6350848e7e0f5db7c710399dd (diff)
Refactor so that all the locate-related stuff in CursorDrag is in one method. Also, wait for timecode transmission to be suspended before sending MMC/MTC locates, rather than hoping it will be suspended in time.
git-svn-id: svn://localhost/ardour2/branches/3.0@8329 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_drag.cc')
-rw-r--r--gtk2_ardour/editor_drag.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index d069e2e984..7f87ae0273 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -1983,17 +1983,33 @@ CursorDrag::CursorDrag (Editor* e, ArdourCanvas::Item* i, bool s)
DEBUG_TRACE (DEBUG::Drags, "New CursorDrag\n");
}
+/** Do all the things we do when dragging the playhead to make it look as though
+ * we have located, without actually doing the locate (because that would cause
+ * the diskstream buffers to be refilled, which is too slow).
+ */
+void
+CursorDrag::fake_locate (framepos_t t)
+{
+ _editor->playhead_cursor->set_position (t);
+
+ Session* s = _editor->session ();
+ if (s->timecode_transmission_suspended ()) {
+ framepos_t const f = _editor->playhead_cursor->current_frame;
+ s->send_mmc_locate (f);
+ s->send_full_time_code (f);
+ }
+
+ _editor->show_verbose_time_cursor (t, 10);
+ _editor->UpdateAllTransportClocks (t);
+}
+
void
CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
{
Drag::start_grab (event, c);
- if (!_stop) {
- framepos_t where = _editor->event_frame (event, 0, 0);
-
- _editor->snap_to_with_modifier (where, event);
- _editor->playhead_cursor->set_position (where);
- }
+ framepos_t where = _editor->event_frame (event, 0, 0);
+ _editor->snap_to_with_modifier (where, event);
_editor->_dragging_playhead = true;
@@ -2009,16 +2025,12 @@ CursorDrag::start_grab (GdkEvent* event, Gdk::Cursor* c)
}
s->request_suspend_timecode_transmission ();
-
- if (s->timecode_transmission_suspended ()) {
- framepos_t const f = _editor->playhead_cursor->current_frame;
- s->send_mmc_locate (f);
- s->send_full_time_code (f);
+ while (!s->timecode_transmission_suspended ()) {
+ /* twiddle our thumbs */
}
}
-
- _editor->show_verbose_time_cursor (_editor->playhead_cursor->current_frame, 10);
- _editor->UpdateAllTransportClocks (_editor->playhead_cursor->current_frame);
+
+ fake_locate (where);
}
void
@@ -2030,22 +2042,11 @@ CursorDrag::motion (GdkEvent* event, bool)
return;
}
- _editor->playhead_cursor->set_position (adjusted_frame);
-
- _editor->show_verbose_time_cursor (_editor->playhead_cursor->current_frame, 10);
-
- Session* s = _editor->session ();
- if (s && s->timecode_transmission_suspended ()) {
- framepos_t const f = _editor->playhead_cursor->current_frame;
- s->send_mmc_locate (f);
- s->send_full_time_code (f);
- }
+ fake_locate (adjusted_frame);
-
#ifdef GTKOSX
_editor->update_canvas_now ();
#endif
- _editor->UpdateAllTransportClocks (_editor->playhead_cursor->current_frame);
}
void