summaryrefslogtreecommitdiffstats
path: root/src/mixer
diff options
context:
space:
mode:
authorJan Holthuis <jholthuis@mixxx.org>2021-07-06 16:24:04 +0200
committerJan Holthuis <jan.holthuis@ruhr-uni-bochum.de>2021-07-08 01:55:38 +0200
commit363ac4c4100f0c6b6ddf0d6e32f1f1855479f097 (patch)
tree25c067c278cdfe3af5562523b749dd13b440e98c /src/mixer
parent4aba92d78cc5ec9d0fb0eebea33b0614e0102f35 (diff)
BaseTrackPlayer: Use mixxx::audio::FramePos internally
Diffstat (limited to 'src/mixer')
-rw-r--r--src/mixer/basetrackplayer.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/mixer/basetrackplayer.cpp b/src/mixer/basetrackplayer.cpp
index 03e2e8f323..1589189304 100644
--- a/src/mixer/basetrackplayer.cpp
+++ b/src/mixer/basetrackplayer.cpp
@@ -265,11 +265,13 @@ void BaseTrackPlayerImpl::loadTrack(TrackPointer pTrack) {
}
if (pLoopCue) {
- double loopStart = pLoopCue->getPosition().toEngineSamplePosMaybeInvalid();
- double loopEnd = loopStart + (pLoopCue->getLengthFrames() * mixxx::kEngineChannelCount);
- if (loopStart != kNoTrigger && loopEnd != kNoTrigger && loopStart <= loopEnd) {
- m_pLoopInPoint->set(loopStart);
- m_pLoopOutPoint->set(loopEnd);
+ const mixxx::audio::FramePos loopStart = pLoopCue->getPosition();
+ if (loopStart.isValid()) {
+ const mixxx::audio::FramePos loopEnd = loopStart + pLoopCue->getLengthFrames();
+ if (loopEnd.isValid() && loopStart <= loopEnd) {
+ m_pLoopInPoint->set(loopStart.toEngineSamplePos());
+ m_pLoopOutPoint->set(loopEnd.toEngineSamplePos());
+ }
}
}
} else {
@@ -294,9 +296,13 @@ TrackPointer BaseTrackPlayerImpl::unloadTrack() {
// Save the loops that are currently set in a loop cue. If no loop cue is
// currently on the track, then create a new one.
- double loopStart = m_pLoopInPoint->get();
- double loopEnd = m_pLoopOutPoint->get();
- if (loopStart != kNoTrigger && loopEnd != kNoTrigger && loopStart <= loopEnd) {
+ const auto loopStart =
+ mixxx::audio::FramePos::fromEngineSamplePosMaybeInvalid(
+ m_pLoopInPoint->get());
+ const auto loopEnd =
+ mixxx::audio::FramePos::fromEngineSamplePosMaybeInvalid(
+ m_pLoopOutPoint->get());
+ if (loopStart.isValid() && loopEnd.isValid() && loopStart <= loopEnd) {
CuePointer pLoopCue;
QList<CuePointer> cuePoints(m_pLoadedTrack->getCuePoints());
QListIterator<CuePointer> it(cuePoints);