diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 0a25997630f..50467635171 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1093,8 +1093,25 @@ void AutoDJProcessor::playerOutroEndChanged(DeckAttributes* pAttributes, double double AutoDJProcessor::getIntroStartSecond(DeckAttributes* pDeck) { const mixxx::audio::FramePos trackEndPosition = pDeck->trackEndPosition(); const mixxx::audio::FramePos introStartPosition = pDeck->introStartPosition(); + const mixxx::audio::FramePos introEndPosition = pDeck->introEndPosition(); if (!introStartPosition.isValid() || introStartPosition > trackEndPosition) { - return getFirstSoundSecond(pDeck); + double firstSoundSecond = getFirstSoundSecond(pDeck); + if (!introEndPosition.isValid() || introEndPosition > trackEndPosition) { + // No intro start and intro end set, use First Sound. + return firstSoundSecond; + } + double introEndSecond = framePositionToSeconds(introEndPosition, pDeck); + if (m_transitionTime >= 0 && firstSoundSecond < introEndSecond) { + double introStartFromTime = introEndSecond - m_transitionTime; + if (introStartFromTime > firstSoundSecond) { + // The introStart is automatically placed by AnalyzerSilence at the first sound + // Here the user has removed it, but has placed an intro end. + // Use the transition time instead the dismissed first sound position. + return introStartFromTime; + } + return firstSoundSecond; + } + return introEndSecond; } return framePositionToSeconds(introStartPosition, pDeck); }