diff options
author | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-01 14:17:48 +0200 |
---|---|---|
committer | Jan Holthuis <jholthuis@mixxx.org> | 2021-07-01 17:19:25 +0200 |
commit | b82ba59435dc9bc56db5d5696e29101ea7aeac16 (patch) | |
tree | 79711e2943bbc7913fb43c6f127a82a9eae44939 /src/audio | |
parent | 4db7cb2483f36d0e199078ce4fd6cd657064c3d9 (diff) |
FramePos: Add fromEngineSamplePos helper method
Diffstat (limited to 'src/audio')
-rw-r--r-- | src/audio/frame.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/audio/frame.h b/src/audio/frame.h index 8cbab7cbc2..6f63d790a6 100644 --- a/src/audio/frame.h +++ b/src/audio/frame.h @@ -4,6 +4,8 @@ #include <cmath> #include <limits> +#include "engine/engine.h" + namespace mixxx { namespace audio { /// FrameDiff_t can be used to store the difference in position between @@ -26,6 +28,14 @@ class FramePos final { : m_framePosition(framePosition) { } + static FramePos fromEngineSamplePos(double engineSamplePos) { + return FramePos(engineSamplePos / mixxx::kEngineChannelCount); + } + + double toEngineSamplePos() const { + return value() * mixxx::kEngineChannelCount; + } + bool isValid() const { return !std::isnan(m_framePosition); } |