From 2c7bfa9eadf75e9d71e864886bf15ed3fadcbb45 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 12 Feb 2023 12:02:33 -0700 Subject: [PATCH] require use of BBT_Argument as both parameter and return type from most methods (GUI edition) --- gtk2_ardour/audio_clock.cc | 2 +- gtk2_ardour/editor.cc | 8 ++++---- gtk2_ardour/editor_audio_import.cc | 2 +- gtk2_ardour/editor_tempodisplay.cc | 16 +++++++++------- gtk2_ardour/step_editor.cc | 2 +- gtk2_ardour/tempo_dialog.cc | 2 +- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 2718fc7542..19008165ad 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -2123,7 +2123,7 @@ AudioClock::samples_from_bbt_string (timepos_t const & pos, const string& str) c return 0; } - BBT_Time bbt; + BBT_Argument bbt; if (sscanf (str.c_str(), BBT_SCANF_FORMAT, &bbt.bars, &bbt.beats, &bbt.ticks) != 3) { return 0; diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index aa42c9f496..272ddf0ac1 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -2957,16 +2957,16 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S if (_grid_type == GridTypeBar) { TempoMetric m (tmap->metric_at (presnap)); - BBT_Time bbt (m.bbt_at (presnap)); + BBT_Argument bbt (m.bbt_at (presnap)); switch (direction) { case RoundDownAlways: - bbt = bbt.round_down_to_bar (); + bbt = BBT_Argument (bbt.reference(), bbt.round_down_to_bar ()); break; case RoundUpAlways: - bbt = bbt.round_up_to_bar (); + bbt = BBT_Argument (bbt.reference(), bbt.round_up_to_bar ()); break; case RoundNearest: - bbt = m.round_to_bar (bbt); + bbt = BBT_Argument (bbt.reference(), m.round_to_bar (bbt)); break; default: break; diff --git a/gtk2_ardour/editor_audio_import.cc b/gtk2_ardour/editor_audio_import.cc index 650f236111..a86686a1df 100644 --- a/gtk2_ardour/editor_audio_import.cc +++ b/gtk2_ardour/editor_audio_import.cc @@ -310,7 +310,7 @@ Editor::import_smf_tempo_map (Evoral::SMF const & smf, timepos_t const & pos) cerr << "new meter from SMF : " << meter << endl; - Temporal::BBT_Time bbt; /* 1|1|0 which is correct for the no-meter case */ + Temporal::BBT_Argument bbt; /* 1|1|0 which is correct for the no-meter case */ if (have_initial_meter) { diff --git a/gtk2_ardour/editor_tempodisplay.cc b/gtk2_ardour/editor_tempodisplay.cc index db5654dded..7f12b15391 100644 --- a/gtk2_ardour/editor_tempodisplay.cc +++ b/gtk2_ardour/editor_tempodisplay.cc @@ -519,9 +519,9 @@ Editor::mouse_add_new_meter_event (timepos_t pos) double note_type = meter_dialog.get_note_type (); - Temporal::BBT_Time requested; - meter_dialog.get_bbt_time (requested); - + Temporal::BBT_Time r; + meter_dialog.get_bbt_time (r); + Temporal::BBT_Argument requested (timepos_t::zero (Temporal::BeatTime), r); TempoMapChange tmc (*this, _("add time signature")); pos = timepos_t (tmc.map().quarters_at (requested)); @@ -631,8 +631,9 @@ Editor::edit_meter_section (Temporal::MeterPoint& section) double const note_type = meter_dialog.get_note_type (); const Meter meter (bpb, note_type); - Temporal::BBT_Time when; - meter_dialog.get_bbt_time (when); + Temporal::BBT_Time w; + meter_dialog.get_bbt_time (w); + Temporal::BBT_Argument when (timepos_t::zero (Temporal::BeatTime), w); TempoMapChange tmc (*this, _("edit time signature")); tmc.map().set_meter (meter, when); @@ -682,8 +683,9 @@ Editor::edit_tempo_section (TempoPoint& section) const Tempo tempo (bpm, end_bpm, nt); - Temporal::BBT_Time when; - tempo_dialog.get_bbt_time (when); + Temporal::BBT_Time w; + tempo_dialog.get_bbt_time (w); + Temporal::BBT_Argument when (timepos_t::zero (Temporal::BeatTime), w); TempoMapChange tmc (*this, _("edit tempo")); tmc.map().replace_tempo (section, tempo, timepos_t (tmc.map().quarters_at (when))); diff --git a/gtk2_ardour/step_editor.cc b/gtk2_ardour/step_editor.cc index 511d2340ef..a8e3748115 100644 --- a/gtk2_ardour/step_editor.cc +++ b/gtk2_ardour/step_editor.cc @@ -420,7 +420,7 @@ StepEditor::step_edit_bar_sync () /* have to go to BBT to round up to bar, unfortunately */ TempoMap::SharedPtr tmap (TempoMap::use()); - BBT_Time bbt (tmap->bbt_at (pos).round_up_to_bar ()); + BBT_Argument bbt (tmap->bbt_at (pos).round_up_to_bar ()); /* now back to beats */ pos = timepos_t (tmap->quarters_at (bbt)); diff --git a/gtk2_ardour/tempo_dialog.cc b/gtk2_ardour/tempo_dialog.cc index 36cba7ea55..1449c51f46 100644 --- a/gtk2_ardour/tempo_dialog.cc +++ b/gtk2_ardour/tempo_dialog.cc @@ -608,7 +608,7 @@ TempoDialog::tap_tempo_focus_out (GdkEventFocus* ) MeterDialog::MeterDialog (TempoMap::SharedPtr const & map, timepos_t const & pos, const string&) : ArdourDialog (_("New Time Signature")) { - Temporal::BBT_Time when (map->round_to_bar (map->bbt_at (pos))); + Temporal::BBT_Argument when (map->round_to_bar (map->bbt_at (pos))); Meter const & meter (map->meter_at (when)); init (when, meter.divisions_per_bar(), meter.note_value(), false, pos.time_domain());