From c1cfa12d6e5136d2e3e5501e83ff74c5009a9e60 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Nov 2014 04:05:42 -0500 Subject: Wrap MusicalTime in a class. This lets us get a more explicit handle on time conversions, and is the main step towards using actual beat:tick time and getting away from floating point precision problems. --- gtk2_ardour/editor_drag.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gtk2_ardour/editor_drag.cc') diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index ab2d2c071e..fa66c952dc 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -5220,7 +5220,7 @@ NoteCreateDrag::grid_frames (framepos_t t) const bool success; Evoral::MusicalTime grid_beats = _editor->get_grid_type_as_beats (success, t); if (!success) { - grid_beats = 1; + grid_beats = Evoral::MusicalTime(1); } return _region_view->region_beats_to_region_frames (grid_beats); @@ -5276,13 +5276,13 @@ NoteCreateDrag::finished (GdkEvent*, bool had_movement) framecnt_t length = (framecnt_t) fabs ((double)(_note[0] - _note[1])); framecnt_t const g = grid_frames (start); - double const one_tick = 1 / Timecode::BBT_Time::ticks_per_beat; + Evoral::MusicalTime const one_tick = Evoral::MusicalTime::ticks(1); if (_editor->snap_mode() == SnapNormal && length < g) { length = g - one_tick; } - double const length_beats = max (one_tick, _region_view->region_frames_to_region_beats (length)); + Evoral::MusicalTime const length_beats = max (one_tick, _region_view->region_frames_to_region_beats (length)); _region_view->create_note_at (start, _drag_rect->y0(), length_beats, false); } -- cgit v1.2.3