Zren / plasma-applet-volumewin7mixer

https://store.kde.org/p/1100894/
37 stars 8 forks source link

Last volume step is skipped #17

Open gondsman opened 4 years ago

gondsman commented 4 years ago

There's something wonky with the volume changing steps because when I increase the volume (either via shortcut or scroll wheel) the last step is always skipped. For example, if the step is 10%, it goes 60->70->80->100, but going the other way around is correct (100->90->80). Am I missing something?

Zren commented 4 years ago

I snap it to 100% if there's less than 1 step to avoid jumping to 99% or something.

https://github.com/Zren/plasma-applet-volumewin7mixer/blob/master/package/contents/ui/code/PulseObjectCommands.js#L33

In PulseAudio, 100% is "65536", and if you divide it by 100, then each step is "655.36". You can't set a Real number to an Integer, so I added that bit of code to avoid losing 0.36 * 100 = 36 away from 100%.

I think I'll lower the threshold to max - volume < step * 0.5. Assuming each step is 10%, it would only jump to 100% if there's less than 5% (86 => 96%).