Skip to content

Commit

Permalink
Auto-DJ: Don't adopt first sound as intro start, when user has explic…
Browse files Browse the repository at this point in the history
…it deleted it.

Use transition time instead if possible, else fall back to first sound.
  • Loading branch information
daschuer committed Aug 13, 2023
1 parent dd608bf commit 430a8f8
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/library/autodj/autodjprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 430a8f8

Please sign in to comment.