From 4376185a6be3921d331b14c539ade512875c04f2 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 29 Oct 2021 12:55:14 -0600 Subject: [PATCH] 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 --- libs/temporal/tempo.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 06592796c1..e91af44587 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -486,9 +486,16 @@ TempoPoint::superclock_at (Temporal::Beats const & qn) const return _sclock; } + if (qn < Beats()) { + /* negative */ + assert (_quarters == Beats()); + } else { + /* positive */ + assert (qn >= _quarters); + } + if (!actually_ramped()) { /* not ramped, use linear */ - assert (qn >= _quarters); const Beats delta = qn - _quarters; 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));