Skip to content

Commit c4d7e75

Browse files
committed
AutoDJProcessor: Move seekToStartPoint logic into calculateTransition()
1 parent ccbe92b commit c4d7e75

1 file changed

Lines changed: 7 additions & 16 deletions

File tree

src/library/autodj/autodjprocessor.cpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,11 +1054,6 @@ void AutoDJProcessor::playerPlayChanged(DeckAttributes* thisDeck, bool playing)
10541054
// This forces the other deck to be the fromDeck.
10551055
thisDeck->startPos = kKeepPosition;
10561056
calculateTransition(otherDeck, thisDeck, true);
1057-
if (thisDeck->startPos != kKeepPosition) {
1058-
// Note: this seek will trigger the playerPositionChanged slot
1059-
// which may calls the calculateTransition() again without seek = true;
1060-
thisDeck->setPlayPosition(thisDeck->startPos);
1061-
}
10621057
}
10631058
}
10641059
}
@@ -1299,6 +1294,12 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck,
12991294
loadNextTrackFromQueue(*pToDeck, false);
13001295
return;
13011296
}
1297+
1298+
if (seekToStartPoint && pToDeck->startPos != kKeepPosition) {
1299+
// Note: This seek will trigger the playerPositionChanged slot
1300+
// which may call calculateTransition() again, but without seekToPosition = true.
1301+
pToDeck->setPlayPosition(pToDeck->startPos);
1302+
}
13021303
}
13031304

13041305
void AutoDJProcessor::calculateTransitionImpl(
@@ -1644,12 +1645,7 @@ void AutoDJProcessor::playerTrackLoaded(DeckAttributes* pDeck, TrackPointer pTra
16441645
}
16451646
pDeck->startPos = kKeepPosition;
16461647
calculateTransition(fromDeck, pDeck, true);
1647-
if (pDeck->startPos != kKeepPosition) {
1648-
// Note: this seek will trigger the playerPositionChanged slot
1649-
// which may calls the calculateTransition() again without seek = true;
1650-
pDeck->setPlayPosition(pDeck->startPos);
1651-
}
1652-
// we are her in the relative domain 0..1
1648+
// we are here in the relative domain 0..1
16531649
if (!fromDeck->isPlaying() && fromDeck->playPosition() >= 1.0) {
16541650
// repeat a probably missed update
16551651
playerPositionChanged(fromDeck, 1.0);
@@ -1811,11 +1807,6 @@ void AutoDJProcessor::setTransitionMode(TransitionMode newMode) {
18111807

18121808
if (pLeftDeck->isPlaying() && !pRightDeck->isPlaying()) {
18131809
calculateTransition(pLeftDeck, pRightDeck, true);
1814-
if (pRightDeck->startPos != kKeepPosition) {
1815-
// Note: this seek will trigger the playerPositionChanged slot
1816-
// which may calls the calculateTransition() again without seek = true;
1817-
pRightDeck->setPlayPosition(pRightDeck->startPos);
1818-
}
18191810
} else if (pRightDeck->isPlaying() && pLeftDeck->isPlaying()) {
18201811
calculateTransition(pRightDeck, pLeftDeck, true);
18211812
if (pLeftDeck->startPos != kKeepPosition) {

0 commit comments

Comments
 (0)