summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2021-10-12 13:40:44 -0500
committerGitHub <noreply@github.com>2021-10-12 13:40:44 -0500
commitc8c1855015d0cc8fc8a914d4ff1c85aac8a388a4 (patch)
treed882323b3ebe2ee7730ed38d6eba272f4719499a /src/engine
parent58572fb6c0e87c59a34c57944126bd8d521a2ea4 (diff)
parent8ec0a449731cc3128d3591303d46290d255ed6e8 (diff)
Merge pull request #4370 from ywwg/cue-seek-fix
Update main cue position before seeking to it
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/controls/cuecontrol.cpp17
-rw-r--r--src/engine/controls/cuecontrol.h4
-rw-r--r--src/engine/enginebuffer.h2
3 files changed, 19 insertions, 4 deletions
diff --git a/src/engine/controls/cuecontrol.cpp b/src/engine/controls/cuecontrol.cpp
index e89bd41864..7601e84454 100644
--- a/src/engine/controls/cuecontrol.cpp
+++ b/src/engine/controls/cuecontrol.cpp
@@ -1342,8 +1342,13 @@ void CueControl::cueCDJ(double value) {
// If quantize is enabled, jump to the cue point since it's not
// necessarily where we currently are
if (m_pQuantizeEnabled->toBool()) {
- // Enginebuffer will quantize more exactly than we can.
- seekAbs(mainCuePosition);
+ // We need to re-get the cue point since it changed.
+ const auto newCuePosition = mixxx::audio::FramePos::fromEngineSamplePosMaybeInvalid(
+ m_pCuePoint->get());
+ if (newCuePosition.isValid()) {
+ // Enginebuffer will quantize more exactly than we can.
+ seekAbs(newCuePosition);
+ }
}
}
} else if (m_currentlyPreviewingIndex == kMainCueIndex) {
@@ -1434,8 +1439,12 @@ void CueControl::cuePlay(double value) {
// If quantize is enabled, jump to the cue point since it's not
// necessarily where we currently are
if (m_pQuantizeEnabled->toBool()) {
- // Enginebuffer will quantize more exactly than we can.
- seekAbs(mainCuePosition);
+ const auto newCuePosition = mixxx::audio::FramePos::fromEngineSamplePosMaybeInvalid(
+ m_pCuePoint->get());
+ if (newCuePosition.isValid()) {
+ // Enginebuffer will quantize more exactly than we can.
+ seekAbs(newCuePosition);
+ }
}
}
} else if (trackAt == TrackAt::Cue) {
diff --git a/src/engine/controls/cuecontrol.h b/src/engine/controls/cuecontrol.h
index 8a6f392e4e..1b674935b1 100644
--- a/src/engine/controls/cuecontrol.h
+++ b/src/engine/controls/cuecontrol.h
@@ -1,5 +1,7 @@
#pragma once
+#include <gtest/gtest_prod.h>
+
#include <QAtomicInt>
#include <QAtomicPointer>
#include <QList>
@@ -236,8 +238,10 @@ class CueControl : public EngineControl {
void cueGotoAndPlay(double v);
void cueGotoAndStop(double v);
void cuePreview(double v);
+ FRIEND_TEST(CueControlTest, SeekOnSetCueCDJ);
void cueCDJ(double v);
void cueDenon(double v);
+ FRIEND_TEST(CueControlTest, SeekOnSetCuePlay);
void cuePlay(double v);
void cueDefault(double v);
void pause(double v);
diff --git a/src/engine/enginebuffer.h b/src/engine/enginebuffer.h
index 9683a7d3b7..8c700b00b6 100644
--- a/src/engine/enginebuffer.h
+++ b/src/engine/enginebuffer.h
@@ -266,6 +266,8 @@ class EngineBuffer : public EngineObject {
BpmControl* m_pBpmControl;
KeyControl* m_pKeyControl;
ClockControl* m_pClockControl;
+ FRIEND_TEST(CueControlTest, SeekOnSetCueCDJ);
+ FRIEND_TEST(CueControlTest, SeekOnSetCuePlay);
CueControl* m_pCueControl;
QList<EngineControl*> m_engineControls;