diff options
author | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-03 11:22:29 +0200 |
---|---|---|
committer | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-03 12:33:37 +0200 |
commit | a710a024062264ede21e89e4f12dec70207463a0 (patch) | |
tree | b9a2a00d3d7ab4125a9525cb9beaaf60bb900075 /src/audio | |
parent | 5dc50d159bd8760292e8e459aa92b9f19a5f9a00 (diff) |
FramePos: Add some comments and simplify valid check
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/frame.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/audio/frame.h b/src/audio/frame.h index 5b22ee458a..dd01bc8602 100644 --- a/src/audio/frame.h +++ b/src/audio/frame.h @@ -37,18 +37,24 @@ class FramePos final { return value() * mixxx::kEngineChannelCount; } + /// Return true if the frame position is valid. Any finite value is + /// considered valid, i.e. any value except NaN and negative/positive + /// infinity. bool isValid() const { - return !util_isnan(m_framePosition) && !util_isinf(m_framePosition); + return util_isfinite(m_framePosition); } void setValue(value_t framePosition) { m_framePosition = framePosition; } + /// Return the underlying primitive value for this frame position. constexpr value_t value() const { return m_framePosition; } + /// Return true if the frame position has a fractional part, i.e. if it is + /// not located at a full frame boundary. bool isFractional() const { DEBUG_ASSERT(isValid()); value_t integerPart; |