mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-10 08:36:32 +01:00
libtemporal: improve implementation/accuracy of Meter::round_to_bar()
This commit is contained in:
parent
e393c5efcf
commit
68f6bff258
1 changed files with 7 additions and 5 deletions
|
|
@ -343,12 +343,14 @@ Meter::bbt_subtract (Temporal::BBT_Time const & bbt, Temporal::BBT_Offset const
|
||||||
Temporal::BBT_Time
|
Temporal::BBT_Time
|
||||||
Meter::round_to_bar (Temporal::BBT_Time const & bbt) const
|
Meter::round_to_bar (Temporal::BBT_Time const & bbt) const
|
||||||
{
|
{
|
||||||
Temporal::BBT_Time b = bbt.round_to_beat ();
|
Beats b (bbt.beats, bbt.ticks);
|
||||||
if (b.beats > _divisions_per_bar/2) {
|
Beats half (Beats::ticks (Beats::PPQN + ((_divisions_per_bar * Beats::PPQN / 2))));
|
||||||
b.bars++;
|
|
||||||
|
if (b >= half) {
|
||||||
|
return BBT_Time (bbt.bars+1, 1, 0);
|
||||||
}
|
}
|
||||||
b.beats = 1;
|
|
||||||
return b;
|
return BBT_Time (bbt.bars, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Temporal::BBT_Time
|
Temporal::BBT_Time
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue