diff --git a/src/engine/enginebuffer.cpp b/src/engine/enginebuffer.cpp index b43cc10e94a..8eb7fb4a4f8 100644 --- a/src/engine/enginebuffer.cpp +++ b/src/engine/enginebuffer.cpp @@ -1310,18 +1310,22 @@ void EngineBuffer::postProcess(const int iBufferSize) { } const mixxx::Bpm localBpm = m_pBpmControl->updateLocalBpm(); double beatDistance = m_pBpmControl->updateBeatDistance(); - // FIXME: Double check if calling setLocalBpm with an invalid value is correct and intended. - mixxx::Bpm newLocalBpm; + const SyncMode mode = m_pSyncControl->getSyncMode(); if (localBpm.isValid()) { - newLocalBpm = localBpm; - } - m_pSyncControl->setLocalBpm(newLocalBpm); - SyncMode mode = m_pSyncControl->getSyncMode(); - m_pSyncControl->reportPlayerSpeed(m_speed_old, m_scratching_old); - if (isLeader(mode)) { - m_pEngineSync->notifyBeatDistanceChanged(m_pSyncControl, beatDistance); - } else if (isFollower(mode)) { - m_pSyncControl->updateTargetBeatDistance(); + m_pSyncControl->setLocalBpm(localBpm); + m_pSyncControl->reportPlayerSpeed(m_speed_old, m_scratching_old); + if (isLeader(mode)) { + m_pEngineSync->notifyBeatDistanceChanged(m_pSyncControl, beatDistance); + } else if (isFollower(mode)) { + m_pSyncControl->updateTargetBeatDistance(); + } + } else if (mode == SyncMode::LeaderSoft) { + // If this channel has been automatically chosen to be the leader but + // no BPM is available, another channel may take over leadership and + // this channel becomes a follower. This may happen if the track is + // analyzed upon load and avoids sudden tempo jumps on the other deck + // while the analysis is still running. + requestSyncMode(SyncMode::Follower); } // Update all the indicators that EngineBuffer publishes to allow