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 e1b2705c5d)
pull/20/head
Michele Calgaro 4 years ago
parent 92f069b7da
commit 48129adff6
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -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);
}
}

Loading…
Cancel
Save