From 90795ea138ac8103a2c0735905be149ad1855cbc Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 30 Jan 2025 11:26:37 -0700 Subject: [PATCH] lighter, simpler math for sample-aligned superclocks --- libs/temporal/tempo.cc | 4 ++-- libs/temporal/temporal/superclock.h | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 5c0aea5b41..2e939d8365 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -557,9 +557,9 @@ TempoPoint::superclock_at (Temporal::Beats const & qn) const } } - /* Now round up to the nearest sample-equivalent superclock value */ + /* Truncate to the nearest sample-equivalent superclock value */ - return sample_aligned_superclock (r, TEMPORAL_SAMPLE_RATE); + return (r / TEMPORAL_SAMPLE_RATE) * TEMPORAL_SAMPLE_RATE; } superclock_t diff --git a/libs/temporal/temporal/superclock.h b/libs/temporal/temporal/superclock.h index 439f74c465..9ebf4a9163 100644 --- a/libs/temporal/temporal/superclock.h +++ b/libs/temporal/temporal/superclock.h @@ -48,7 +48,6 @@ static inline superclock_t superclock_ticks_per_second() { return _superclock_ti static inline superclock_t superclock_to_samples (superclock_t s, int sr) { return PBD::muldiv_floor (s, sr, superclock_ticks_per_second()); } static inline superclock_t samples_to_superclock (int64_t samples, int sr) { return PBD::muldiv_round (samples, superclock_ticks_per_second(), superclock_t (sr)); } -static inline superclock_t sample_aligned_superclock (superclock_t s, int sr) { return PBD::muldiv_floor (s, sr, sr); } LIBTEMPORAL_API extern int most_recent_engine_sample_rate;