Skip to content

Commit

Permalink
SyncControl: Simplify slotRateChanged() implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Holzhaus committed Aug 6, 2021
1 parent e99bf9d commit 6b495a3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/engine/sync/synccontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,17 +492,24 @@ void SyncControl::updateAudible() {

void SyncControl::slotRateChanged() {
mixxx::Bpm bpm = getLocalBpm();
if (bpm.isValid()) {
bpm *= m_pRateRatio->get();
if (!bpm.isValid()) {
return;
}

const double rateRatio = m_pRateRatio->get();
bpm *= rateRatio;
if (kLogger.traceEnabled()) {
kLogger.trace() << getGroup() << "SyncControl::slotRateChanged" << m_pRateRatio->get() << bpm;
kLogger.trace() << getGroup() << "SyncControl::slotRateChanged" << rateRatio << bpm;
}
if (bpm.isValid() && isSynchronized()) {
// When reporting our bpm, remove the multiplier so the leaders all
// think the followers have the same bpm.
m_pEngineSync->notifyRateChanged(this, bpm / m_leaderBpmAdjustFactor);

// BPM may be invalid if rateRatio is NaN or infinity.
if (!bpm.isValid() || !isSynchronized()) {
return;
}

// When reporting our bpm, remove the multiplier so the leaders all
// think the followers have the same bpm.
m_pEngineSync->notifyRateChanged(this, bpm / m_leaderBpmAdjustFactor);
}

void SyncControl::reportPlayerSpeed(double speed, bool scratching) {
Expand Down

0 comments on commit 6b495a3

Please sign in to comment.