diff --git a/res/schema.xml b/res/schema.xml index 1bd7acc3c63..da02e9f5818 100644 --- a/res/schema.xml +++ b/res/schema.xml @@ -80,6 +80,8 @@ reapplying those migrations. id INTEGER PRIMARY KEY AUTOINCREMENT, track_id INTEGER NOT NULL REFERENCES library(id), type INTEGER DEFAULT 0 NOT NULL, + position INTEGER DEFAULT -1 NOT NULL, length INTEGER DEFAULT 0 NOT NULL, hotcue INTEGER DEFAULT -1 NOT NULL, diff --git a/src/audio/frame.h b/src/audio/frame.h index 1e37faeb652..1136196d6ac 100644 --- a/src/audio/frame.h +++ b/src/audio/frame.h @@ -44,7 +44,15 @@ class FramePos final { /// values), use `FramePos::toEngineSamplePosMaybeInvalid` instead. double toEngineSamplePos() const { DEBUG_ASSERT(isValid()); - return value() * mixxx::kEngineChannelCount; + double engineSamplePos = value() * mixxx::kEngineChannelCount; + // In the rare but possible instance that the position is valid but + // the engine sample position is exactly -1.0, we nudge the position + // because otherwise fromEngineSamplePosMaybeInvalid() will think + // the position is invalid. + if (engineSamplePos == kLegacyInvalidEnginePosition) { + return kLegacyInvalidEnginePosition - 0.0001; + } + return engineSamplePos; } /// Return a `FramePos` from a given engine sample position. Sample