summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-04-02 17:03:39 +0100
committerCarl Hetherington <cth@carlh.net>2014-04-02 17:03:39 +0100
commit89b2ca022fd8020a713d3a66c0bee93b2b95aac1 (patch)
treea5d554406cab48ad233f9bea34b146973bc1391c /src/lib
parent854f2e5bbb7ffb9758b823af87034033033f3cb8 (diff)
Allow round-up to non-integer sample rates.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/dcpomatic_time.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/lib/dcpomatic_time.h b/src/lib/dcpomatic_time.h
index e0d47d9c8..59986e6d8 100644
--- a/src/lib/dcpomatic_time.h
+++ b/src/lib/dcpomatic_time.h
@@ -123,12 +123,11 @@ public:
* at some sampling rate.
* @param r Sampling rate.
*/
- ContentTime round_up (int r) {
- int64_t const n = HZ / r;
+ ContentTime round_up (float r) {
+ int64_t const n = rint (HZ / r);
int64_t const a = _t + n - 1;
return ContentTime (a - (a % n));
}
-
static ContentTime from_seconds (double s) {
return ContentTime (s * HZ);
@@ -199,8 +198,8 @@ public:
* at some sampling rate.
* @param r Sampling rate.
*/
- DCPTime round_up (int r) {
- int64_t const n = HZ / r;
+ DCPTime round_up (float r) {
+ int64_t const n = rint (HZ / r);
int64_t const a = _t + n - 1;
return DCPTime (a - (a % n));
}