temporal: add Meter::round_to_beat()

This commit is contained in:
Paul Davis 2022-11-29 09:34:28 -07:00
parent f2a725b311
commit 883527ba3e
2 changed files with 12 additions and 0 deletions

View file

@ -366,6 +366,17 @@ Meter::round_up_to_beat (Temporal::BBT_Time const & bbt) const
return b;
}
Temporal::BBT_Time
Meter::round_to_beat (Temporal::BBT_Time const & bbt) const
{
Temporal::BBT_Time b = bbt.round_to_beat ();
if (b.beats > _divisions_per_bar) {
b.bars++;
b.beats = 1;
}
return b;
}
Temporal::Beats
Meter::to_quarters (Temporal::BBT_Offset const & offset) const
{