Bug 435522 - Widget tooltip shows wrong volume level
Summary: Widget tooltip shows wrong volume level
Status: RESOLVED FIXED
Alias: None
Product: plasma-pa
Classification: Plasma
Component: applet (show other bugs)
Version: 5.21.4
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-08 18:44 UTC by Riccardo Robecchi
Modified: 2021-04-20 15:43 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Riccardo Robecchi 2021-04-08 18:44:06 UTC
SUMMARY
The tooltip of the widget appears to show wrong information on the volume level currently selected in some cases.

STEPS TO REPRODUCE
1. hover the mouse over the widget to display the tooltip
2. compare the number shown there with the one shown inside the widget or in utilities such as PulseAudio Volume Control

OBSERVED RESULT
The volume level displayed by the tooltip is lower than that of the widget itself.

EXPECTED RESULT
The two values are identical.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon
KDE Plasma Version: 5.21.4
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
This does not seem to happen with all of the devices I have. I noticed it with a specific device, a Shanling UA2, while the others appear to show the correct volume level.
Comment 1 Nate Graham 2021-04-09 02:05:19 UTC
Will be fixed with https://invent.kde.org/plasma/plasma-pa/-/merge_requests/57.
Comment 2 Chris Holland 2021-04-20 15:42:14 UTC
Git commit dedcbccf753545795c0194fd98cca081e47baf70 by Chris Holland.
Committed on 20/04/2021 at 02:56.
Pushed by ngraham into branch 'master'.

Increment volume by percent instead of a constant volumeStep

Jumping by a fixed volumeStep has issues as the value is rounded.
65536/100 = 655.36
65536/100*5 = 3276.8
volumeStep = round(3276.8) = 3277

The floor() patch has an easy to test bug when jumping from 100% to
94% instead of 95% since volumeStep is rounded up.
Eg: 65536 => 62259 (-3277) 100% => 94%  (-6%)

The original round() logic also has issues when volume is around:
f(x) = (65536/100) / 2 + (65536/100) * x

amixer sset Master 983 # f(1)=983.04
Eg: 983 => 4260 (+3277) 1% => 7%  (+6%)

This patch adds changeVolumeByPercent(volumeObject, deltaPercent) to
increment any sink or source by a %volume. It also moves the common
code in increaseVolume() and decreaseVolume() into a new function.
Related: bug 434769
FIXED-IN: 5.21.5

M  +33   -32   applet/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-pa/commit/dedcbccf753545795c0194fd98cca081e47baf70
Comment 3 Nate Graham 2021-04-20 15:43:03 UTC
Git commit 26994d67552d21ce41f641de473be2b7b3509834 by Nate Graham, on behalf of Chris Holland.
Committed on 20/04/2021 at 15:42.
Pushed by ngraham into branch 'Plasma/5.21'.

Increment volume by percent instead of a constant volumeStep

Jumping by a fixed volumeStep has issues as the value is rounded.
65536/100 = 655.36
65536/100*5 = 3276.8
volumeStep = round(3276.8) = 3277

The floor() patch has an easy to test bug when jumping from 100% to
94% instead of 95% since volumeStep is rounded up.
Eg: 65536 => 62259 (-3277) 100% => 94%  (-6%)

The original round() logic also has issues when volume is around:
f(x) = (65536/100) / 2 + (65536/100) * x

amixer sset Master 983 # f(1)=983.04
Eg: 983 => 4260 (+3277) 1% => 7%  (+6%)

This patch adds changeVolumeByPercent(volumeObject, deltaPercent) to
increment any sink or source by a %volume. It also moves the common
code in increaseVolume() and decreaseVolume() into a new function.
Related: bug 434769
FIXED-IN: 5.21.5


(cherry picked from commit dedcbccf753545795c0194fd98cca081e47baf70)

M  +33   -32   applet/contents/ui/main.qml

https://invent.kde.org/plasma/plasma-pa/commit/26994d67552d21ce41f641de473be2b7b3509834