diff options
author | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-01 14:55:19 +0200 |
---|---|---|
committer | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-01 17:19:25 +0200 |
commit | 0191a50db0d2b77760c41c90b7d4ad98c0d0ea4a (patch) | |
tree | e72b7e512b75cf59cdaac96fd62b9b33403b3c5b /src/audio | |
parent | e7e39e4063af018ba384ec01ec9946e82b1a3d07 (diff) |
FramePos: Add helper method to truncate to full sample positions
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/frame.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/audio/frame.h b/src/audio/frame.h index e5bdc3c941..2a18f39845 100644 --- a/src/audio/frame.h +++ b/src/audio/frame.h @@ -48,6 +48,15 @@ class FramePos final { return m_framePosition; } + bool isFractional() const { + value_t integerPart; + return std::modf(value(), &integerPart) == 0; + } + + [[nodiscard]] FramePos toFullFrames() const { + return FramePos(std::floor(value())); + } + FramePos& operator+=(FrameDiff_t increment) { m_framePosition += increment; return *this; |