File kdemultimedia-trinity-fix-rounding-error.patch of Package kdemultimedia3
From e1b2705c5dc6c888924dda8f57c88edeb43494ba Mon Sep 17 00:00:00 2001
From: Michele Calgaro <michele.calgaro@yahoo.it>
Date: Thu, 21 May 2020 17:14:22 +0900
Subject: 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>
---
diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp
index d8e93fc..150b196 100644
--- a/kmix/mixer.cpp
+++ b/kmix/mixer.cpp
@@ -570,7 +570,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);
}
}
--
cgit v1.2.1