13
0

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; return 0;
} }
BBT_Time bbt; BBT_Argument bbt;
if (sscanf (str.c_str(), BBT_SCANF_FORMAT, &bbt.bars, &bbt.beats, &bbt.ticks) != 3) { if (sscanf (str.c_str(), BBT_SCANF_FORMAT, &bbt.bars, &bbt.beats, &bbt.ticks) != 3) {
return 0; return 0;

View File

@ -2957,16 +2957,16 @@ Editor::snap_to_bbt (timepos_t const & presnap, Temporal::RoundMode direction, S
if (_grid_type == GridTypeBar) { if (_grid_type == GridTypeBar) {
TempoMetric m (tmap->metric_at (presnap)); TempoMetric m (tmap->metric_at (presnap));
BBT_Time bbt (m.bbt_at (presnap)); BBT_Argument bbt (m.bbt_at (presnap));
switch (direction) { switch (direction) {
case RoundDownAlways: case RoundDownAlways:
bbt = bbt.round_down_to_bar (); bbt = BBT_Argument (bbt.reference(), bbt.round_down_to_bar ());
break; break;
case RoundUpAlways: case RoundUpAlways:
bbt = bbt.round_up_to_bar (); bbt = BBT_Argument (bbt.reference(), bbt.round_up_to_bar ());
break; break;
case RoundNearest: case RoundNearest:
bbt = m.round_to_bar (bbt); bbt = BBT_Argument (bbt.reference(), m.round_to_bar (bbt));
break; break;
default: default:
break; 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; 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) { 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 (); double note_type = meter_dialog.get_note_type ();
Temporal::BBT_Time requested; Temporal::BBT_Time r;
meter_dialog.get_bbt_time (requested); meter_dialog.get_bbt_time (r);
Temporal::BBT_Argument requested (timepos_t::zero (Temporal::BeatTime), r);
TempoMapChange tmc (*this, _("add time signature")); TempoMapChange tmc (*this, _("add time signature"));
pos = timepos_t (tmc.map().quarters_at (requested)); 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 (); double const note_type = meter_dialog.get_note_type ();
const Meter meter (bpb, note_type); const Meter meter (bpb, note_type);
Temporal::BBT_Time when; Temporal::BBT_Time w;
meter_dialog.get_bbt_time (when); meter_dialog.get_bbt_time (w);
Temporal::BBT_Argument when (timepos_t::zero (Temporal::BeatTime), w);
TempoMapChange tmc (*this, _("edit time signature")); TempoMapChange tmc (*this, _("edit time signature"));
tmc.map().set_meter (meter, when); tmc.map().set_meter (meter, when);
@ -682,8 +683,9 @@ Editor::edit_tempo_section (TempoPoint& section)
const Tempo tempo (bpm, end_bpm, nt); const Tempo tempo (bpm, end_bpm, nt);
Temporal::BBT_Time when; Temporal::BBT_Time w;
tempo_dialog.get_bbt_time (when); tempo_dialog.get_bbt_time (w);
Temporal::BBT_Argument when (timepos_t::zero (Temporal::BeatTime), w);
TempoMapChange tmc (*this, _("edit tempo")); TempoMapChange tmc (*this, _("edit tempo"));
tmc.map().replace_tempo (section, tempo, timepos_t (tmc.map().quarters_at (when))); 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 */ /* have to go to BBT to round up to bar, unfortunately */
TempoMap::SharedPtr tmap (TempoMap::use()); 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 */ /* now back to beats */
pos = timepos_t (tmap->quarters_at (bbt)); 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&) MeterDialog::MeterDialog (TempoMap::SharedPtr const & map, timepos_t const & pos, const string&)
: ArdourDialog (_("New Time Signature")) : 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)); Meter const & meter (map->meter_at (when));
init (when, meter.divisions_per_bar(), meter.note_value(), false, pos.time_domain()); init (when, meter.divisions_per_bar(), meter.note_value(), false, pos.time_domain());