summaryrefslogtreecommitdiffstats
path: root/src/analyzer
diff options
context:
space:
mode:
authorDaniel Schürmann <daschuer@mixxx.org>2021-03-01 09:51:06 +0100
committerDaniel Schürmann <daschuer@mixxx.org>2021-03-07 23:17:28 +0100
commita6cc8067b6d20442d0930e38f88a999d72befb12 (patch)
tree149e9b87a8ca761bef1132028deb31bf68d578da /src/analyzer
parentd8ef2ebe874b9cc2722dfa4605df21b9c9d550b6 (diff)
Fix reaanalyze rules for tracks with beat grids generated from a BPM value only
Diffstat (limited to 'src/analyzer')
-rw-r--r--src/analyzer/analyzerbeats.cpp36
1 files changed, 11 insertions, 25 deletions
diff --git a/src/analyzer/analyzerbeats.cpp b/src/analyzer/analyzerbeats.cpp
index 2036e041fa..b3d81f3aee 100644
--- a/src/analyzer/analyzerbeats.cpp
+++ b/src/analyzer/analyzerbeats.cpp
@@ -165,14 +165,20 @@ bool AnalyzerBeats::shouldAnalyze(TrackPointer pTrack) const {
qDebug() << "Re-analyzing track with invalid BPM despite preference settings.";
return true;
}
- if (pBeats->findNextBeat(0) <= 0.0) {
+
+ QString subVersion = pBeats->getSubVersion();
+ if (subVersion == mixxx::rekordboxconstants::beatsSubversion) {
+ return m_bPreferencesReanalyzeImported;
+ }
+
+ if (subVersion.isEmpty() && pBeats->findNextBeat(0) <= 0.0 &&
+ m_pluginId != mixxx::AnalyzerSoundTouchBeats::pluginInfo().id) {
+ // This happens if the beat grid was created from the metadata BPM value.
qDebug() << "First beat is 0 for grid so analyzing track to find first beat.";
return true;
}
- // Version check
QString version = pBeats->getVersion();
- QString subVersion = pBeats->getSubVersion();
QHash<QString, QString> extraVersionInfo = getExtraVersionInfo(
pluginID,
m_bPreferencesFastAnalysis);
@@ -184,9 +190,7 @@ bool AnalyzerBeats::shouldAnalyze(TrackPointer pTrack) const {
iMinBpm,
iMaxBpm,
extraVersionInfo);
- if (subVersion == mixxx::rekordboxconstants::beatsSubversion) {
- return m_bPreferencesReanalyzeImported;
- }
+
if (version == newVersion && subVersion == newSubVersion) {
// If the version and settings have not changed then if the world is
// sane, re-analyzing will do nothing.
@@ -268,25 +272,7 @@ void AnalyzerBeats::storeResults(TrackPointer pTrack) {
return;
}
- // If the user prefers to replace old beatgrids with newly generated ones or
- // the old beatgrid has 0-bpm then we replace it.
- bool zeroCurrentBpm = pCurrentBeats->getBpm() == 0.0;
- if (m_bPreferencesReanalyzeOldBpm || zeroCurrentBpm) {
- if (zeroCurrentBpm) {
- qDebug() << "Replacing 0-BPM beatgrid with a" << pBeats->getBpm()
- << "beatgrid.";
- }
- pTrack->setBeats(pBeats);
- return;
- }
-
- // If we got here then the user doesn't want to replace the beatgrid but
- // since the first beat is zero we'll apply the offset we just detected.
- double currentFirstBeat = pCurrentBeats->findNextBeat(0);
- double newFirstBeat = pBeats->findNextBeat(0);
- if (currentFirstBeat == 0.0 && newFirstBeat > 0) {
- pTrack->setBeats(pCurrentBeats->translate(newFirstBeat));
- }
+ pTrack->setBeats(pBeats);
}
// static