From b0a732e6368e02abf730b3d62bbc84c98bd87f74 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 5 Aug 2020 16:05:42 -0600 Subject: [PATCH] Temporal: extend timecnt_t API to provide samples() method, using thread-local sample rate --- libs/temporal/temporal/timeline.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/temporal/temporal/timeline.h b/libs/temporal/temporal/timeline.h index d6d26b8e5d..33a79dff10 100644 --- a/libs/temporal/temporal/timeline.h +++ b/libs/temporal/temporal/timeline.h @@ -280,7 +280,8 @@ class LIBTEMPORAL_API timecnt_t { Temporal::TimeDomain time_domain () const { return _position.time_domain (); } - superclock_t superclocks() const { if (_position.is_superclock()) return _distance.val(); return compute_superclocks(); } + superclock_t superclocks() const { if (_position.is_superclock()) return _distance.val(); return compute_superclocks(); } + int64_t samples() const { return superclock_to_samples (superclocks(), _thread_sample_rate); } Temporal::Beats beats () const { if (_position.is_beats()) return Beats::ticks (_distance.val()); return compute_beats(); } int64_t ticks () const { if (_position.is_beats()) return _distance.val(); return compute_ticks(); }