From 68cdd50b321410232fc0614700be0787d4fd6706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 18 Jul 2020 01:12:16 +0200 Subject: Initalized outro_start_position and outro_end_position during test --- src/test/autodjprocessor_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/autodjprocessor_test.cpp b/src/test/autodjprocessor_test.cpp index 77bad5411c..ce85211060 100644 --- a/src/test/autodjprocessor_test.cpp +++ b/src/test/autodjprocessor_test.cpp @@ -51,6 +51,8 @@ class FakeDeck : public BaseTrackPlayer { outroEndPos(ConfigKey(group, "outro_end_position")) { play.setButtonMode(ControlPushButton::TOGGLE); repeat.setButtonMode(ControlPushButton::TOGGLE); + outroStartPos.set(Cue::kNoPosition); + outroEndPos.set(Cue::kNoPosition); } void fakeTrackLoadedEvent(TrackPointer pTrack) { -- cgit v1.2.3 From 8a8529c44c7b8d0f7ad56a9caae5de2d96930a7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sat, 18 Jul 2020 01:13:57 +0200 Subject: TransitionMode::FullIntroOutro: verify in all cases that the intro does not overlap with the outro of the same deck --- src/library/autodj/autodjprocessor.cpp | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 2f11e7e569..ab31f062b9 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1245,33 +1245,21 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, // If only the outro or intro length is marked but not both, use the one // that is marked for the transition time. If neither is marked, fall // back to the transition time from the spinbox. - if (outroLength > 0 && introLength > 0) { - if (outroLength > introLength) { - pFromDeck->fadeBeginPos = outroEnd - introLength; - pFromDeck->fadeEndPos = outroEnd; - pToDeck->startPos = introStart; - } else { - pFromDeck->fadeBeginPos = outroStart; - pFromDeck->fadeEndPos = outroEnd; - pToDeck->startPos = introStart; + if (outroLength > 0) { + if (introLength <= 0 || introLength > outroLength) { + // no intro defined, use outro lengh. + introLength = outroLength; } - } else if (outroLength > 0 && introLength <= 0) { - 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) { + } + if (introLength > 0) { + if (introStart + introLength > pToDeck->fadeBeginPos) { + // End intro before next outro starts + introLength = pToDeck->fadeBeginPos - introStart; + VERIFY_OR_DEBUG_ASSERT(introLength > 0) { // We seek to intro start above in this case so this never happens - outroLength = 1; + introLength = 1; } - pFromDeck->fadeBeginPos = outroEnd - outroLength; } - pFromDeck->fadeEndPos = outroEnd; - pToDeck->startPos = introStart; - } else if (introLength > 0 && outroLength <= 0) { pFromDeck->fadeBeginPos = outroEnd - introLength; pFromDeck->fadeEndPos = outroEnd; pToDeck->startPos = introStart; -- cgit v1.2.3 From 95cecd0cea9999f4af0fc59cf2f3f4727ac994bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 19 Jul 2020 22:39:50 +0200 Subject: improve comments --- src/library/autodj/autodjprocessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index ab31f062b9..ac0fa52129 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1247,7 +1247,8 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, // back to the transition time from the spinbox. if (outroLength > 0) { if (introLength <= 0 || introLength > outroLength) { - // no intro defined, use outro lengh. + // Use outro length when the intro is not defined or longer + // than the outro. introLength = outroLength; } } -- cgit v1.2.3 From 31dfee2953c174263b39b26c5b748f6001bacc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Sun, 19 Jul 2020 22:51:34 +0200 Subject: use a new variable transitionLength instead of re-use intro length. --- src/library/autodj/autodjprocessor.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index ac0fa52129..5f32861824 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1223,7 +1223,7 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, double introLength = introEnd - introStart; switch (m_transitionMode) { - case TransitionMode::FullIntroOutro: + case TransitionMode::FullIntroOutro: { // Use the outro or intro length for the transition time, whichever is // shorter. Let the full outro and intro play; do not cut off any part // of either. @@ -1245,29 +1245,32 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, // If only the outro or intro length is marked but not both, use the one // that is marked for the transition time. If neither is marked, fall // back to the transition time from the spinbox. + double transitionLength = introLength; if (outroLength > 0) { - if (introLength <= 0 || introLength > outroLength) { + if (transitionLength <= 0 || transitionLength > outroLength) { // Use outro length when the intro is not defined or longer // than the outro. - introLength = outroLength; + transitionLength = outroLength; } } - if (introLength > 0) { - if (introStart + introLength > pToDeck->fadeBeginPos) { + if (transitionLength > 0) { + const double transitionEnd = introStart + transitionLength; + if (transitionEnd > pToDeck->fadeBeginPos) { // End intro before next outro starts - introLength = pToDeck->fadeBeginPos - introStart; - VERIFY_OR_DEBUG_ASSERT(introLength > 0) { + transitionLength = pToDeck->fadeBeginPos - introStart; + VERIFY_OR_DEBUG_ASSERT(transitionLength > 0) { // We seek to intro start above in this case so this never happens - introLength = 1; + transitionLength = 1; } } - pFromDeck->fadeBeginPos = outroEnd - introLength; + pFromDeck->fadeBeginPos = outroEnd - transitionLength; pFromDeck->fadeEndPos = outroEnd; pToDeck->startPos = introStart; } else { useFixedFadeTime(pFromDeck, pToDeck, fromDeckPosition, outroEnd, introStart); } break; + } case TransitionMode::FadeAtOutroStart: // Use the outro or intro length for the transition time, whichever is // shorter. If the outro is longer than the intro, cut off the end -- cgit v1.2.3 From b8562baecf69b38a62e3ae6b29e6957d5a057e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 24 Jul 2020 23:10:15 +0200 Subject: Adopt the chenges for FadeAtOutroStart as well --- src/library/autodj/autodjprocessor.cpp | 49 +++++++++++++++------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 5f32861824..f8438002f2 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1269,9 +1269,8 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, } else { useFixedFadeTime(pFromDeck, pToDeck, fromDeckPosition, outroEnd, introStart); } - break; - } - case TransitionMode::FadeAtOutroStart: + } break; + case TransitionMode::FadeAtOutroStart: { // Use the outro or intro length for the transition time, whichever is // shorter. If the outro is longer than the intro, cut off the end // of the outro. @@ -1293,40 +1292,36 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, // If only the outro or intro length is marked but not both, use the one // that is marked for the transition time. If neither is marked, fall // back to the transition time from the spinbox. - if (outroLength > 0 && introLength > 0) { - pFromDeck->fadeBeginPos = outroStart; - if (outroLength > introLength) { - // Cut off end of outro - pFromDeck->fadeEndPos = outroStart + introLength; - } else { - pFromDeck->fadeEndPos = outroEnd; + double transitionLength = outroLength; + double fadeBeginPos = outroStart; + if (transitionLength > 0) { + if (introLength > 0) { + if (outroLength > introLength) { + // Cut off end of outro + transitionLength = introLength; + } } - pToDeck->startPos = introStart; - } else if (outroLength > 0 && introLength <= 0) { - if (outroLength + introStart < pToDeck->fadeBeginPos) { - pFromDeck->fadeBeginPos = outroStart; - pFromDeck->fadeEndPos = outroEnd; - } 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) { + const double transitionEnd = introStart + transitionLength; + if (transitionEnd > pToDeck->fadeBeginPos) { + // End intro before next outro starts + transitionLength = pToDeck->fadeBeginPos - introStart; + VERIFY_OR_DEBUG_ASSERT(transitionLength > 0) { // We seek to intro start above in this case so this never happens - outroLength = 1; + transitionLength = 1; } - pFromDeck->fadeBeginPos = outroStart; - pFromDeck->fadeEndPos = outroStart + outroLength; } + pFromDeck->fadeBeginPos = outroStart; + pFromDeck->fadeEndPos = outroStart + transitionLength; pToDeck->startPos = introStart; - } else if (introLength > 0 && outroLength <= 0) { - pFromDeck->fadeBeginPos = outroEnd - introLength; + } else if (introLength > 0) { + transitionLength = introLength; + pFromDeck->fadeBeginPos = outroEnd - transitionLength; pFromDeck->fadeEndPos = outroEnd; pToDeck->startPos = introStart; } else { useFixedFadeTime(pFromDeck, pToDeck, fromDeckPosition, outroEnd, introStart); } - break; + } break; case TransitionMode::FixedSkipSilence: { double startPoint; pToDeck->fadeBeginPos = getLastSoundSecond(pToDeck); -- cgit v1.2.3 From 0f983aa09fa3b0f9dabbb1e586c81f1ff6c32b8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 28 Jul 2020 14:17:49 +0200 Subject: Removed unusde variable --- src/library/autodj/autodjprocessor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index f8438002f2..252171bed4 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1293,7 +1293,6 @@ void AutoDJProcessor::calculateTransition(DeckAttributes* pFromDeck, // that is marked for the transition time. If neither is marked, fall // back to the transition time from the spinbox. double transitionLength = outroLength; - double fadeBeginPos = outroStart; if (transitionLength > 0) { if (introLength > 0) { if (outroLength > introLength) { -- cgit v1.2.3