require use of BBT_Argument as both parameter and return type from most methods (GUI edition)

This commit is contained in:
Paul Davis 2023-02-12 12:02:33 -07:00
parent 259499fc5f
commit 2c7bfa9ead
6 changed files with 17 additions and 15 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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)));

View File

@ -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));

View File

@ -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());