Bug 267449 - DBus call to setMasterVolume(value) sets the Master volume to a lower value
Summary: DBus call to setMasterVolume(value) sets the Master volume to a lower value
Status: RESOLVED UPSTREAM
Alias: None
Product: kmix
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Esken
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-02 11:21 UTC by Diego Casella
Modified: 2011-03-03 09:50 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Casella 2011-03-02 11:21:18 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Hi, I'm using KMix compiled from svn (KMix 3.9-alpha, rev 1223100), and I'm writing a simple app which allows to raise/lower the Master volume by using dbus calls to KMix daemon.
The problem is the following: if I want to set the volume to, say 75, I obviously call the setMasterVolume() method with 75 as parameter but, if I check later the actual value with the masterVolume() call, I get a value of 72.
On my laptop the difference between the expected and real value is always +3, but i don't know if that would be the same on other computers.
I've tried to reproduce the issue with direct calls made from qdbusviewer, and the problem still persists.


Reproducible: Always

Steps to Reproduce:
* Open qdbusviewer;
* select the "org.kde.kmix" dbus interface;
* from the "Methods" treewidget, select a "Mixer" device (i.e. "Mixer0");
* click the "org.Kde.KMix" sub-item, and then click the "setMasterVolume" method: a dialog will popup;
* insert a random value, and press enter;
* now click the "masterVolume" method do check the current value: it will be lower than the one you set in the previous step.

Actual Results:  
The volume set with "setMasterVolume" and the volume we get with "masterVolume" are not the same.

Expected Results:  
The volume set with "setMasterVolume" and the volume we get with "masterVolume" should be the same.
Comment 1 Lamarque V. Souza 2011-03-02 19:05:20 UTC
I think this happens because each sound card uses its own step when increasing and decreasing the volume. The hardware will adjust to the closest value if you try to change it to a value that it does not support, from 75 to 72 in your example.

For example, my soundcard does not use values 71, 74, 76, 79 in the 7x range. If I try to use any of these values it uses the first lower value close to it.

Even using amixer (a non-KDE program) has a similar effect (amixer uses the first higher value instead of the first lower):

amixer -c 0 -- sset Master 71%

So I think that is not a KDE bug, it is the way the sound card (or alsa) works. Those values are in percentage, probably internally the sound card volume uses a different scale. When converting from percentage to that scale causes those drifts.
Comment 2 Diego Casella 2011-03-03 09:50:03 UTC
That makes sense :)
I've tried with alsamixer too and the behavior is the same, definitely not a KDE bug. It's kind of sad tho, I would expect a  more fine-grained resolution.