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>
pull/19/head
Michele Calgaro 4 years ago
parent bc9049aa6f
commit e1b2705c5d
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -65,7 +65,7 @@ KMixWindow : public TDEMainWindow, virtual public KMixIface
void setVolume(int percentage); void setVolume(int percentage);
void increaseVolume(int percentage); void increaseVolume(int percentage);
void decreaseVolume(int percentage); void decreaseVolume(int percentage);
int volume(); int volume();
void setAbsoluteVolume(long absoluteVolume); void setAbsoluteVolume(long absoluteVolume);
long absoluteVolume(); long absoluteVolume();

@ -570,7 +570,9 @@ int Mixer::volume( int deviceidx )
} }
else 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