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:
parent
2b9b08aa22
commit
4376185a6b
@ -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));
|
||||||
|
Loading…
Reference in New Issue
Block a user