temporal: add Meter::round_up_to_beat_div()

reimplement round_up_to_beat() in terms of round_up_to_beat_div()
This commit is contained in:
Paul Davis 2023-09-04 10:47:32 -06:00
parent f1f5df7c9a
commit 13bdfda81a
2 changed files with 4 additions and 3 deletions

View File

@ -364,9 +364,9 @@ Meter::round_to_bar (Temporal::BBT_Time const & bbt) const
}
Temporal::BBT_Time
Meter::round_up_to_beat (Temporal::BBT_Time const & bbt) const
Meter::round_up_to_beat_div (Temporal::BBT_Time const & bbt, int beat_div) const
{
Temporal::BBT_Time b = bbt.round_up_to_beat ();
Temporal::BBT_Time b = bbt.round_up_to_beat_div (beat_div);
if (b.beats > _divisions_per_bar) {
b.bars++;
b.beats = 1;

View File

@ -339,7 +339,8 @@ class LIBTEMPORAL_API Meter {
BBT_Time bbt_add (BBT_Time const & bbt, BBT_Offset const & add) const;
BBT_Time bbt_subtract (BBT_Time const & bbt, BBT_Offset const & sub) const;
BBT_Time round_to_bar (BBT_Time const &) const;
BBT_Time round_up_to_beat (BBT_Time const &) const;
BBT_Time round_up_to_beat_div (BBT_Time const &, int beat_div) const;
BBT_Time round_up_to_beat (BBT_Time const & bbt) const { return round_up_to_beat_div (bbt, 1); }
BBT_Time round_to_beat (BBT_Time const &) const;
Beats to_quarters (BBT_Offset const &) const;