From f3a5aaaad636da8753aa542613e6789b2783dc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 18 Apr 2023 01:15:06 +0200 Subject: [PATCH 1/3] Improve warning messages --- src/library/autodj/autodjprocessor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index ef2ba01e725..69e9abe97cb 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1131,8 +1131,9 @@ double AutoDJProcessor::getFirstSoundSecond(DeckAttributes* pDeck) { if (firstSound <= endSamplePosition) { return samplePositionToSeconds(firstSound, pDeck); } else { - qWarning() << "Audible Sound Cue starts after track end using:" - << pTrack->getLocation(); + qWarning() << "Audible Sound Cue starts after track end in:" + << pTrack->getLocation() + << "Using the first sample instead."; } } } @@ -1153,8 +1154,9 @@ double AutoDJProcessor::getLastSoundSecond(DeckAttributes* pDeck) { if (lastSound <= endSamplePosition) { return samplePositionToSeconds(lastSound, pDeck); } else { - qWarning() << "Audible Sound Cue ends after track end using:" - << pTrack->getLocation(); + qWarning() << "Audible Sound Cue ends after track end in:" + << pTrack->getLocation() + << "Using the last sample instead."; } } } From b3a95efad393de94989a940dc01ae7323ab880d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 18 Apr 2023 01:17:19 +0200 Subject: [PATCH 2/3] move endSamplePosition closer to usage --- src/library/autodj/autodjprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index 69e9abe97cb..ee27c7de920 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1123,11 +1123,11 @@ double AutoDJProcessor::getFirstSoundSecond(DeckAttributes* pDeck) { return 0.0; } - double endSamplePosition = pDeck->trackSamples(); CuePointer pFromTrackAudibleSound = pTrack->findCueByType(mixxx::CueType::AudibleSound); if (pFromTrackAudibleSound) { double firstSound = pFromTrackAudibleSound->getPosition(); if (firstSound > 0.0) { + double endSamplePosition = pDeck->trackSamples(); if (firstSound <= endSamplePosition) { return samplePositionToSeconds(firstSound, pDeck); } else { From 65cd5b07f20a5b0d1a531bf63be36cd9a289f128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Tue, 18 Apr 2023 01:21:17 +0200 Subject: [PATCH 3/3] Rename trackEndSample --- src/library/autodj/autodjprocessor.cpp | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/library/autodj/autodjprocessor.cpp b/src/library/autodj/autodjprocessor.cpp index ee27c7de920..38ebe339ebf 100644 --- a/src/library/autodj/autodjprocessor.cpp +++ b/src/library/autodj/autodjprocessor.cpp @@ -1074,18 +1074,18 @@ void AutoDJProcessor::playerOutroEndChanged(DeckAttributes* pAttributes, double } double AutoDJProcessor::getIntroStartSecond(DeckAttributes* pDeck) { - double endSamplePosition = pDeck->trackSamples(); + double trackEndSample = pDeck->trackSamples(); double introStartSample = pDeck->introStartPosition(); - if (introStartSample == Cue::kNoPosition || introStartSample > endSamplePosition) { + if (introStartSample == Cue::kNoPosition || introStartSample > trackEndSample) { return getFirstSoundSecond(pDeck); } return samplePositionToSeconds(introStartSample, pDeck); } double AutoDJProcessor::getIntroEndSecond(DeckAttributes* pDeck) { - double endSamplePosition = pDeck->trackSamples(); + double trackEndSample = pDeck->trackSamples(); double introEndSample = pDeck->introEndPosition(); - if (introEndSample == Cue::kNoPosition || introEndSample > endSamplePosition) { + if (introEndSample == Cue::kNoPosition || introEndSample > trackEndSample) { // Assume a zero length intro if introEnd is not set. // The introStart is automatically placed by AnalyzerSilence, so use // that as a fallback if the user has not placed outroStart. If it has @@ -1096,9 +1096,9 @@ double AutoDJProcessor::getIntroEndSecond(DeckAttributes* pDeck) { } double AutoDJProcessor::getOutroStartSecond(DeckAttributes* pDeck) { - double endSamplePosition = pDeck->trackSamples(); + double trackEndSample = pDeck->trackSamples(); double outroStartSample = pDeck->outroStartPosition(); - if (outroStartSample == Cue::kNoPosition || outroStartSample > endSamplePosition) { + if (outroStartSample == Cue::kNoPosition || outroStartSample > trackEndSample) { // Assume a zero length outro if outroStart is not set. // The outroEnd is automatically placed by AnalyzerSilence, so use // that as a fallback if the user has not placed outroStart. If it has @@ -1109,9 +1109,9 @@ double AutoDJProcessor::getOutroStartSecond(DeckAttributes* pDeck) { } double AutoDJProcessor::getOutroEndSecond(DeckAttributes* pDeck) { - double endSamplePosition = pDeck->trackSamples(); + double trackEndSample = pDeck->trackSamples(); double outroEndSample = pDeck->outroEndPosition(); - if (outroEndSample == Cue::kNoPosition || outroEndSample > endSamplePosition) { + if (outroEndSample == Cue::kNoPosition || outroEndSample > trackEndSample) { return getLastSoundSecond(pDeck); } return samplePositionToSeconds(outroEndSample, pDeck);; @@ -1127,8 +1127,8 @@ double AutoDJProcessor::getFirstSoundSecond(DeckAttributes* pDeck) { if (pFromTrackAudibleSound) { double firstSound = pFromTrackAudibleSound->getPosition(); if (firstSound > 0.0) { - double endSamplePosition = pDeck->trackSamples(); - if (firstSound <= endSamplePosition) { + double trackEndSample = pDeck->trackSamples(); + if (firstSound <= trackEndSample) { return samplePositionToSeconds(firstSound, pDeck); } else { qWarning() << "Audible Sound Cue starts after track end in:" @@ -1146,12 +1146,12 @@ double AutoDJProcessor::getLastSoundSecond(DeckAttributes* pDeck) { return 0.0; } - double endSamplePosition = pDeck->trackSamples(); + double trackEndSample = pDeck->trackSamples(); CuePointer pCueAudibleSound = pTrack->findCueByType(mixxx::CueType::AudibleSound); if (pCueAudibleSound && pCueAudibleSound->getLength() > 0) { double lastSound = pCueAudibleSound->getEndPosition(); if (lastSound > 0) { - if (lastSound <= endSamplePosition) { + if (lastSound <= trackEndSample) { return samplePositionToSeconds(lastSound, pDeck); } else { qWarning() << "Audible Sound Cue ends after track end in:" @@ -1160,7 +1160,7 @@ double AutoDJProcessor::getLastSoundSecond(DeckAttributes* pDeck) { } } } - return samplePositionToSeconds(endSamplePosition, pDeck); + return samplePositionToSeconds(trackEndSample, pDeck); } double AutoDJProcessor::getEndSecond(DeckAttributes* pDeck) { @@ -1169,8 +1169,8 @@ double AutoDJProcessor::getEndSecond(DeckAttributes* pDeck) { return 0.0; } - double endSamplePosition = pDeck->trackSamples(); - return samplePositionToSeconds(endSamplePosition, pDeck); + double trackEndSample = pDeck->trackSamples(); + return samplePositionToSeconds(trackEndSample, pDeck); } double AutoDJProcessor::samplePositionToSeconds(double samplePosition, DeckAttributes* pDeck) {