-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix BPM adjust in BpmControl #2204
Conversation
@uklotzde The bpm control is expected to not limit the range artificially, as indicated in this comment of the bpmcontrol.cpp file: "Pick a wide range (kBpmRangeMin to kBpmRangeMax) and allow out of bounds sets". The range on the control is set so that the MIDI range (0..127) can be mapped to a float range (0..1.0). So, I believe the previous math:min and math:max were an error, but the current ifs are also an unneeded limitation (ok, the minimum might be worth it, since it's zero and we don't want to go to negative numbers). |
The behavior is now predictable when reaching the lower or upper limit and not causing any discontinuities. I don't have any opinion on the range or limits, other than we need to prevent values <= 0.0. This fix = Upper/lower bounds as before, but without unexpected the behavior |
The Adjust BPM Down button is not limited to 300. I just set a track to 310 BPM, clicked the Adjust BPM Down button and it modified it by 0.01 as expected. Adjust BPM Up should work the same. Currently the highest BPM in my library is exactly 300 though..... |
Sorry found bit in code now. I see that you only checked a lower boundary when going down and upper when going up, hence why it behaved like this. Not checked on this PR, only confirming on r6875 from which I posted the original bug report. |
The reported bug should be fixed now, the unnecessary upper bound has been removed, and the code quality has been improved. I don't plan any other changes, because I'm not aware which side effects this might cause. |
src/engine/bpmcontrol.cpp
Outdated
m_pEngineBpm = new ControlLinPotmeter(ConfigKey(group, "bpm"), 1, 200, 1, 0.1, true); | ||
// bpm_up / bpm_down steps by kBpmRangeStep | ||
// bpm_up_small / bpm_down_small steps by kBpmRangeSmallStep | ||
m_pEngineBpm = new ControlLinPotmeter(ConfigKey(group, "bpm"), kBpmRangeMin, kBpmRangeMax, kBpmRangeStep, kBpmRangeSmallStep, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please break this line.
src/engine/bpmcontrol.cpp
Outdated
double new_bpm = math_max(10.0, pBeats->getBpm() - .01); | ||
pBeats->setBpm(new_bpm); | ||
double bpm = pBeats->getBpm(); | ||
if (bpm > kBpmAdjustMin) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit pick: if (bpm >= kBpmAdjustMin + kBpmAdjustStep)
to avoid a conditional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not correct if you want to ensure to reach kBpmAdjustMin eventually when repeatedly lowering the tempo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've found an alternative and correct solution that is even more concise.
LGTM, I have just added two minor comments jumping in my eyes. just to clarify a ControlLinPotmeter needs reasonable limits, this is 1 ... 200. |
Thank you. |
https://bugs.launchpad.net/mixxx/+bug/1836480