Skip to content

Align volume by steps to be a factor of volumePercentageStep

Tom Ripley requested to merge ripleytom/kmix:align_volume into master

Currently when you change volume by steps, it accumulates errors from each steps.

For example for a span of 88 with a step of 5% it will go: 100 - 95 - 91 - 86 - 82 - 77 - 72 - 68 - 63 - etc

With this PR it will go: 100 - 95 - 91 - 85 - 80 - 76 - 70 - 66 - 60 - etc

Which is more what I'd expect it to be.

Another issue I encountered is the step from configuration is not changed until KMix is restarted. Intuitively I'd use Settings::volumePercentageStep() directly in Volume::volumeStep() instead of having a global initialized through Volume::setVolumeStep(), I'm not sure if there is a reason not to?

edit: Added a commit removing the global.

Edited by Tom Ripley

Merge request reports