Skip to content

Commit

Permalink
Fix auto dj stop issue in case of short tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Oct 26, 2019
1 parent 1fd1a04 commit 010fd5c
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,19 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck,
pToDeck->startPos = introStart;
}
} else if (outroLength > 0 && introLength <= 0) {
pFromDeck->fadeBeginPos = outroStart;
if (outroLength + introStart < pToDeck->fadeBeginPos) {
pFromDeck->fadeBeginPos = outroStart;
} else {
// This happens if the toDeck track has no intro set and the
// outro of the fromDeck track is longer than the whole toDeck
// track
outroLength = pToDeck->fadeBeginPos - introStart;
VERIFY_OR_DEBUG_ASSERT(outroLength > 0) {
// We seek to intro start above in this case so this never happens
outroLength = 1;
}
pFromDeck->fadeBeginPos = outroEnd - outroLength;
}
pFromDeck->fadeEndPos = outroEnd;
pToDeck->startPos = introStart;
} else if (introLength > 0 && outroLength <= 0) {
Expand Down Expand Up @@ -1159,7 +1171,19 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck,
}
pToDeck->startPos = introStart;
} else if (outroLength > 0 && introLength <= 0) {
pFromDeck->fadeBeginPos = outroStart;
if (outroLength + introStart < pToDeck->fadeBeginPos) {
pFromDeck->fadeBeginPos = outroStart;
} else {
// This happens if the toDeck track has no intro set and the
// outro of the fromDeck track is longer than the whole toDeck
// track
outroLength = pToDeck->fadeBeginPos - introStart;
VERIFY_OR_DEBUG_ASSERT(outroLength > 0) {
// We seek to intro start above in this case so this never happens
outroLength = 1;
}
pFromDeck->fadeBeginPos = outroEnd - outroLength;
}
pFromDeck->fadeEndPos = outroEnd;
pToDeck->startPos = introStart;
} else if (introLength > 0 && outroLength <= 0) {
Expand Down

0 comments on commit 010fd5c

Please sign in to comment.