Skip to content
Commit dedcbccf authored by Chris Holland's avatar Chris Holland
Browse files

Increment volume by percent instead of a constant volumeStep

Jumping by a fixed volumeStep has issues as the value is rounded.
65536/100 = 655.36
65536/100*5 = 3276.8
volumeStep = round(3276.8) = 3277

The floor() patch has an easy to test bug when jumping from 100% to
94% instead of 95% since volumeStep is rounded up.
Eg: 65536 => 62259 (-3277) 100% => 94%  (-6%)

The original round() logic also has issues when volume is around:
f(x) = (65536/100) / 2 + (65536/100) * x

amixer sset Master 983 # f(1)=983.04
Eg: 983 => 4260 (+3277) 1% => 7%  (+6%)

This patch adds changeVolumeByPercent(volumeObject, deltaPercent) to
increment any sink or source by a %volume. It also moves the common
code in increaseVolume() and decreaseVolume() into a new function.

BUG: 434769
BUG: 435522
FIXED-IN: 5.21.5
parent f0df3e64
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment