diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-21 17:14:22 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-25 13:39:22 +0900 |
commit | 48129adff6c35b093bda523e8c105df65d1ab053 (patch) | |
tree | 28f97e9153201ad2a5cbb3ea319c3e8a8384cfa2 /kmix/mixer.cpp | |
parent | 92f069b7da22a6bc3be2c6f2903a7166ae58bc45 (diff) | |
download | tdemultimedia-48129adff6c35b093bda523e8c105df65d1ab053.tar.gz tdemultimedia-48129adff6c35b093bda523e8c105df65d1ab053.zip |
KMix: fixed rounding error on volume reading. This was preventing 1% volume increase steps from working properly.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit e1b2705c5dc6c888924dda8f57c88edeb43494ba)
Diffstat (limited to 'kmix/mixer.cpp')
-rw-r--r-- | kmix/mixer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp index d020ef47..f2f3d188 100644 --- a/kmix/mixer.cpp +++ b/kmix/mixer.cpp @@ -568,7 +568,9 @@ int Mixer::volume( int deviceidx ) } else { - return ( vol.getVolume( Volume::LEFT )*100) / volumeRange ; + // Make sure to round correctly, otherwise the volume level will always be 1% too low + // and increments of 1% of top of the value read will result in no change to the actual level + return ((100.0 * vol.getVolume(Volume::LEFT) + volumeRange / 2) / volumeRange); } } |