Created
July 26, 2022 19:15
-
-
Save marcsello/71d72414b4d79dceb5f4e286658c57a5 to your computer and use it in GitHub Desktop.
Disable BPM halving when syncing deck bpm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/engine/controls/bpmcontrol.cpp b/src/engine/controls/bpmcontrol.cpp | |
| index e1d6ffddc8..0e78298b74 100644 | |
| --- a/src/engine/controls/bpmcontrol.cpp | |
| +++ b/src/engine/controls/bpmcontrol.cpp | |
| @@ -317,8 +317,8 @@ bool BpmControl::syncTempo() { | |
| double fOtherBpm = pOtherEngineBuffer->getBpm(); | |
| double fOtherLocalBpm = pOtherEngineBuffer->getLocalBpm(); | |
| - //qDebug() << "this" << "bpm" << fThisBpm << "filebpm" << fThisLocalBpm; | |
| - //qDebug() << "other" << "bpm" << fOtherBpm << "filebpm" << fOtherLocalBpm; | |
| + qDebug() << "this" << "bpm" << fThisBpm << "filebpm" << fThisLocalBpm; | |
| + qDebug() << "other" << "bpm" << fOtherBpm << "filebpm" << fOtherLocalBpm; | |
| //////////////////////////////////////////////////////////////////////////// | |
| // Rough proof of how syncing works -- rryan 3/2011 | |
| @@ -357,18 +357,20 @@ bool BpmControl::syncTempo() { | |
| // algorithm sometimes finding double or half BPMs. This avoids drastic | |
| // scales. | |
| - double fFileBpmDelta = fabs(fThisLocalBpm - fOtherLocalBpm); | |
| + //double fFileBpmDelta = fabs(fThisLocalBpm - fOtherLocalBpm); | |
| + /* | |
| if (fabs(fThisLocalBpm * 2.0 - fOtherLocalBpm) < fFileBpmDelta) { | |
| desiredRate /= 2.0; | |
| } else if (fabs(fThisLocalBpm - 2.0 * fOtherLocalBpm) < fFileBpmDelta) { | |
| desiredRate *= 2.0; | |
| } | |
| + */ | |
| - if (desiredRate < 2.0 && desiredRate > 0.5) { | |
| +// if (desiredRate < 2.0 && desiredRate > 0.5) { | |
| m_pEngineBpm->set(m_pLocalBpm->get() * desiredRate); | |
| m_pRateRatio->set(desiredRate); | |
| return true; | |
| - } | |
| +/// } | |
| } | |
| return false; | |
| } | |
| diff --git a/src/engine/sync/synccontrol.cpp b/src/engine/sync/synccontrol.cpp | |
| index 98a555543a..e7f2137b15 100644 | |
| --- a/src/engine/sync/synccontrol.cpp | |
| +++ b/src/engine/sync/synccontrol.cpp | |
| @@ -262,15 +262,15 @@ double SyncControl::determineBpmMultiplier(double myBpm, double targetBpm) const | |
| if (myBpm == 0.0 || targetBpm == 0.0) { | |
| return kBpmUnity; | |
| } | |
| - double unityRatio = myBpm / targetBpm; | |
| +// double unityRatio = myBpm / targetBpm; | |
| // the square root of 2 (1.414) is the | |
| // rate threshold that works vice versa for this and the target. | |
| - double unityRatioSquare = unityRatio * unityRatio; | |
| - if (unityRatioSquare > kBpmDouble) { | |
| +// double unityRatioSquare = unityRatio * unityRatio; | |
| +/* if (unityRatioSquare > kBpmDouble) { | |
| return kBpmDouble; | |
| } else if (unityRatioSquare < kBpmHalve) { | |
| return kBpmHalve; | |
| - } | |
| + } */ | |
| return kBpmUnity; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment