diff options
author | David Robillard <d@drobilla.net> | 2014-11-17 19:53:30 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-17 19:53:30 -0500 |
commit | f7ebae85a7228c4b2d753d7c574574ec767d60f7 (patch) | |
tree | d5801a9beca8378f43b6ec1822870d48e1e27eab | |
parent | 02d735ff00bcb8728e70285783104c6e372096f6 (diff) |
Fix "maybe" rounding bug.
Introduced in d63161426f256c293c92b73f1be4b375f962d298.
-rw-r--r-- | libs/ardour/tempo.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index 6f667a93b6..e775092066 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1243,7 +1243,6 @@ TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir) BBTPointList::const_iterator i = bbt_before_or_at (fr); BBT_Time the_beat; uint32_t ticks_one_subdivisions_worth; - uint32_t difference; bbt_time (fr, the_beat, i); @@ -1283,20 +1282,12 @@ TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir) /* round to previous (or same iff dir == RoundDownMaybe) */ - uint32_t mod = the_beat.ticks % ticks_one_subdivisions_worth; - - if (mod == 0 && dir == RoundDownMaybe) { - /* right on the subdivision, which is fine, so do nothing */ + uint32_t difference = the_beat.ticks % ticks_one_subdivisions_worth; - } else if (mod == 0) { - /* right on the subdivision, so the difference is just the subdivision ticks */ + if (difference == 0 && dir == RoundDownAlways) { + /* right on the subdivision, but force-rounding down, + so the difference is just the subdivision ticks */ difference = ticks_one_subdivisions_worth; - } else { - /* not on subdivision, compute distance to previous subdivision, which - is just the modulus. - */ - - difference = mod; } if (the_beat.ticks < difference) { |