13
0

temporal: fix TempoPoint::superclock_at (Beats)

a negative beat position needs to be legal, so the assert was moved and modified. The only check
for a negative value is that the TempoPoint being used is at absolute zero.

This check might turn out to be wrong in the future, but for now we still require a tempo and
meter point at absolute zero
This commit is contained in:
Paul Davis 2021-10-29 12:55:14 -06:00
parent 2b9b08aa22
commit 4376185a6b

View File

@ -486,9 +486,16 @@ TempoPoint::superclock_at (Temporal::Beats const & qn) const
return _sclock; return _sclock;
} }
if (qn < Beats()) {
/* negative */
assert (_quarters == Beats());
} else {
/* positive */
assert (qn >= _quarters);
}
if (!actually_ramped()) { if (!actually_ramped()) {
/* not ramped, use linear */ /* not ramped, use linear */
assert (qn >= _quarters);
const Beats delta = qn - _quarters; const Beats delta = qn - _quarters;
const superclock_t spqn = superclocks_per_quarter_note (); const superclock_t spqn = superclocks_per_quarter_note ();
return _sclock + (spqn * delta.get_beats()) + int_div_round ((spqn * delta.get_ticks()), superclock_t (Temporal::ticks_per_beat)); return _sclock + (spqn * delta.get_beats()) + int_div_round ((spqn * delta.get_ticks()), superclock_t (Temporal::ticks_per_beat));