+ int64_t frames_round (T r) const {
+ /* We must cast to double here otherwise if T is integer
+ the calculation will round down before we get the chance
+ to llrint().
+ */
+ return llrint (_t * double(r) / HZ);
+ }
+
+ template <typename T>
+ int64_t frames_floor (T r) const {
+ return floor (_t * r / HZ);
+ }
+
+ template <typename T>
+ int64_t frames_ceil (T r) const {
+ /* We must cast to double here otherwise if T is integer
+ the calculation will round down before we get the chance
+ to ceil().
+ */
+ return ceil (_t * double(r) / HZ);