From 0093ae07b0b1257c48d0e9c9085f3c5f3a9fba10 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 6 Dec 2020 12:57:48 -0700 Subject: [PATCH] cleanup after timecnt_t API changed (GUI edition) --- gtk2_ardour/audio_clock.cc | 2 +- gtk2_ardour/editor_drag.cc | 18 ++++++++++++------ gtk2_ardour/step_editor.cc | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 64e64d4b1c..9932a0cc59 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1949,7 +1949,7 @@ AudioClock::current_duration (timepos_t pos) const switch (_mode) { case BBT: - ret = sample_duration_from_bbt_string (pos, _layout->get_text()); + ret = timecnt_t (sample_duration_from_bbt_string (pos, _layout->get_text())); break; case Timecode: diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc index 128281be8d..793536df56 100644 --- a/gtk2_ardour/editor_drag.cc +++ b/gtk2_ardour/editor_drag.cc @@ -2369,7 +2369,8 @@ RegionRippleDrag::RegionRippleDrag (Editor* e, ArdourCanvas::Item* i, RegionView // Rippling accross tracks disabled. Rippling on all tracks is the way to go in the future. allow_moves_across_tracks = false; // (selected_regions.playlists().size() == 1); prev_tav = NULL; - prev_amount = 0; +#warning NUTEMPO need to pick time domain here + prev_amount = timecnt_t (); exclude = new RegionList; for (RegionSelection::iterator i =selected_regions.begin(); i != selected_regions.end(); ++i) { exclude->push_back((*i)->region()); @@ -2452,7 +2453,8 @@ RegionRippleDrag::motion (GdkEvent* event, bool first_move) remove_unselected_from_views (prev_amount, false); // ripple previous playlist according to the regions that have been removed onto the new playlist prev_tav->playlist()->ripple(prev_position, -selection_length, exclude); - prev_amount = 0; +#warning NUTEMPO need to pick time domain here + prev_amount = timecnt_t (); // move just the selected regions RegionMoveDrag::motion(event, first_move); @@ -4714,7 +4716,7 @@ MarkerDrag::setup_pointer_offset () void MarkerDrag::setup_video_offset () { - _video_offset = 0; + _video_offset = timecnt_t (Temporal::AudioTime); _preview_video = true; } @@ -5691,7 +5693,8 @@ SelectionDrag::setup_pointer_offset () { switch (_operation) { case CreateSelection: - _pointer_offset = 0; +#warning NUTEMPO need to pick time domain here + _pointer_offset = timecnt_t (); break; case SelectionStartTrim: @@ -7162,7 +7165,7 @@ CrossfadeEdgeDrag::motion (GdkEvent*, bool) /* now check with the region that this is legal */ - new_length = ar->verify_xfade_bounds (new_length.samples(), start); + new_length = timecnt_t (ar->verify_xfade_bounds (new_length.samples(), start)); if (start) { arv->reset_fade_in_shape_width (ar, new_length.samples()); @@ -7188,7 +7191,10 @@ CrossfadeEdgeDrag::finished (GdkEvent*, bool) len = timecnt_t (ar->fade_out()->back()->when); } - new_length = ar->verify_xfade_bounds ((len + timecnt_t (_editor->pixel_to_sample (distance))).samples(), start); + samplecnt_t samples = _editor->pixel_to_sample (distance); + timecnt_t tdist = timecnt_t (samples); + timecnt_t newlen = len + tdist; + new_length = timecnt_t (ar->verify_xfade_bounds (newlen.samples(), start)); _editor->begin_reversible_command ("xfade trim"); ar->playlist()->clear_owned_changes (); diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index 234997545a..e0842561ba 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -135,11 +135,11 @@ StepEditor::reset_step_edit_beat_pos () const timepos_t ep = _editor.get_preferred_edit_position(); timecnt_t distance_from_start (step_edit_region->position().distance (ep)); - if (distance_from_start < 0) { + if (distance_from_start.negative()) { /* this can happen with snap enabled, and the edit point == Playhead. we snap the position of the new region, and it can end up after the edit point. */ - distance_from_start = 0; + distance_from_start = timecnt_t (ep.time_domain()); } step_edit_beat_pos = distance_from_start.beats();