Bug 249180 - KMix does not restore volume when logging in
Summary: KMix does not restore volume when logging in
Status: RESOLVED FIXED
Alias: None
Product: kmix
Classification: Applications
Component: general (show other bugs)
Version: 4.1
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Esken
URL:
Keywords:
: 210262 253546 256131 272844 287761 298347 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-27 05:55 UTC by gjditchfield
Modified: 2014-04-25 11:50 UTC (History)
19 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.3
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gjditchfield 2010-08-27 05:55:42 UTC
Version:           3.7 (using KDE 4.5.0) 
OS:                Linux

When I log in, the sound volume is always set inaudibly low. KMix always shows the volume at 6%.

Reproducible: Didn't try

Steps to Reproduce:
Check the "Restore volumes on login" box in KMix's Configure dialog.
Use the volume-up key or the slider in KMix's system tray widget to raise the volume level to a higher level.
Log out and log back in.

Actual Results:  
I hear no KDE start-up sound.  The KMix system tray widget shows the volume to be 6%.

Expected Results:  
I should hear sounds, and the widget should show the same volume level as it did before logging out.

OS: Kubuntu Meerkat, various alpha versions.
Current installed packages
 kmix 4:4.5.0b-0ubuntu1
 pulseaudio 1:0.9.22~0.9.21+stable-queue-32-g8478-0ubuntu17

lspci output:
00:00.0 Host bridge: Intel Corporation Core Processor DRAM Controller (rev 12)
00:02.0 VGA compatible controller: Intel Corporation Core Processor Integrated Graphics Controller (rev 12)
00:16.0 Communication controller: Intel Corporation 5 Series/3400 Series Chipset HECI Controller (rev 06)
00:16.3 Serial controller: Intel Corporation 5 Series/3400 Series Chipset KT Controller (rev 06)
00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06)
00:1a.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06)
00:1c.0 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 1 (rev 06)
00:1c.1 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 2 (rev 06)
00:1c.3 PCI bridge: Intel Corporation 5 Series/3400 Series Chipset PCI Express Root Port 4 (rev 06)
00:1d.0 USB Controller: Intel Corporation 5 Series/3400 Series Chipset USB2 Enhanced Host Controller (rev 06)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev a6)
00:1f.0 ISA bridge: Intel Corporation Mobile 5 Series Chipset LPC Interface Controller (rev 06)
00:1f.2 SATA controller: Intel Corporation 5 Series/3400 Series Chipset 6 port SATA AHCI Controller (rev 06)
00:1f.6 Signal processing controller: Intel Corporation 5 Series/3400 Series Chipset Thermal Subsystem (rev 06)
43:00.0 Network controller: Intel Corporation Centrino Advanced-N 6200 (rev 35)
44:06.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 06)
44:06.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 25)
44:06.2 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev bb)
ff:00.0 Host bridge: Intel Corporation Core Processor QuickPath Architecture Generic Non-core Registers (rev 02)
ff:00.1 Host bridge: Intel Corporation Core Processor QuickPath Architecture System Address Decoder (rev 02)
ff:02.0 Host bridge: Intel Corporation Core Processor QPI Link 0 (rev 02)
ff:02.1 Host bridge: Intel Corporation Core Processor QPI Physical 0 (rev 02)
ff:02.2 Host bridge: Intel Corporation Core Processor Reserved (rev 02)
ff:02.3 Host bridge: Intel Corporation Core Processor Reserved (rev 02)

Compiler: cc
Comment 1 Alexey Shildyakov 2010-08-31 11:16:26 UTC
Maybe related to 210262
Comment 2 Marcelo Bossoni 2011-01-07 01:36:32 UTC
Hi there,
I managed to find a solution... Open Kmix configuration and UNCHECK restore volume option. Someone put inverse logic on that button... OR alsa/pulseaudio handles volume restore much better than kmix

Check this bug on redhat bugzilla
https://bugzilla.redhat.com/show_bug.cgi?id=657373
Comment 3 gjditchfield 2011-01-08 02:57:05 UTC
I confirm the fix; after unchecking the option and rebooting, my Maverick machine emitted the KDE start-up sound for the first time in months.
Comment 4 Leon Maurer 2011-03-01 17:14:11 UTC
I can also confirm the fix; this computer was always mute on startup, but now it restores correctly. I'll try it on my other computer which always has volume set to 100% on startup...

Now I'll just have to remember to re-check that box if anyone ever bothers to fix this bug.
Comment 5 gjditchfield 2011-03-02 03:06:04 UTC
This  bug is still present in KMix 3.8 using KDE Development Platform 4.6.00 (4.6.0), installed from ppa:kubuntu-ppa/backports.
Comment 6 Christian Esken 2011-08-11 23:52:19 UTC
Thanks for the feedback. This is a very interesting observation.

As Pulseaudio is operating the hardware controls, it might be in conflict with KMix. But if Pulseaudio is detected, KMix will not restore the volume levels at all.

My guess is that Pulseaudio is not yet running when the volume restore happens (done by kmixctrl). So "kmixctrl" would use the ALSA backend and restore volumes, while "kmix" runs much later and detects "Pulseaudio".

So we have a race condition. We have to think very hard for a solution, but an idea would be to automatically disable the restore option when KMix runs with the Pulseaudio backend.

This is a generic design issue (also affects MPRIS more or less), so I will NOT assign it over to the Pulsaudio component.
Comment 7 Colin Guthrie 2011-08-12 09:27:19 UTC
I think KMix should just remove all volume restore options. It's really something that should be handled below the UI layer. This would likely solve the issues in this case.

That said, PA should still restore it's volumes overwriting what kmixctrl has written if this race is as you describe. So I'm not sure what is going on.
Comment 8 Christian Esken 2011-08-15 20:51:50 UTC
The volume is a user preference, so "someone" has to restore volumes on user/session level. And as kmixctrl is not UI related, it is currently a good candidate.

PA doesn't restore volume level for my OpenSUSE and Ubuntu boxes (I didn't configure anything to enable or disable that). So I guess it's still an explanation, and disabling volume restoring if Pulseaudio is at least worth a try.
Comment 9 Christian Esken 2011-08-17 21:10:36 UTC
*** Bug 256131 has been marked as a duplicate of this bug. ***
Comment 10 Christian Esken 2011-08-17 21:12:24 UTC
I will now try to explicitly sync the volume configuration object. Probably it will help.
Comment 11 Christian Esken 2011-08-17 21:15:45 UTC
SVN commit 1247885 by esken:

CCBUGS: 249180
Explicitly Sync volume configuration (try to fix volume saving)

 M  +1 -0      kmix.cpp  
 M  +1 -0      kmixd.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1247885
Comment 12 Christian Esken 2011-08-17 21:19:12 UTC
To the bugreporter (and everybody els with this bug) - I'd like to do an experiment:

Can you try to change the volume levels, and the quit KMix once (Ctrl-q). Quitting should definitely save the volume levels (but make sure you have volume restoring enabled in KMix). If those volume levels are restored on your next login, you will have at least an workaround. Please let me know once you tried that.

You can find out whether the volume levels were changed by playing around with the volume levels and then using the volume restorer manually in a Konsole window:

kmixctrl -s      # To save
kmixctrl -r      # To restore

Please note there might be other applications messing around with the sound volume, go example  the Flashplayer (often used in a Web browser). But also any Multimedia application might be changing the volume after KMix has done it.
Comment 13 Christian Esken 2011-09-09 19:13:03 UTC
Awaiting feedback
Comment 14 gjditchfield 2011-09-10 19:40:50 UTC
I tried the experiment requested in comment 12 above, with KMix 3.8 and KDE 4.6.5 on Ubuntu Natty

When I changed the volume, logged out, and logged back in, the volume was set to 6%, so the bug was still there.

When I changed the volume, made KMix quit, logged out, and logged back in, KMix started running and the volume was set to 6%.

When I changed the volume to 40%, made KMix quit, ran "kmixctrl -s" in Konsole, logged out, and logged back in, KMix started running but the volume remained at 40%.
Comment 15 Christian Esken 2011-09-17 10:35:57 UTC
Thanks for the feedback. It shows that KMix is not able to save the volume. Probably the fix in comment 11 will fix it. I will backport this to KDE4.7 so people will be able to try with KDE4.7.2.
Comment 16 Christian Esken 2011-09-17 10:47:16 UTC
SVN commit 1254081 by esken:

CCBUGS: 249180
Fix volume writing. Backport to branch 4.7


 M  +1 -0      kmix.cpp  
 M  +1 -0      kmixd.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1254081
Comment 17 Christian Esken 2011-09-17 10:47:37 UTC
SVN commit 1254082 by esken:

CCBUGS: 249180
Fix volume writing. Backport to branch 4.6


 M  +1 -0      kmix.cpp  
 M  +1 -0      kmixd.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1254082
Comment 18 Colin Guthrie 2011-09-17 11:12:50 UTC
Can I just clarify here. Are the users experiencing problems using PulseAudio or not?

When PulseAudio is used KMix should refuse to save/restore volumes.

As I stated earlier, doing this kind of stuff in a UI layer is just wrong, especially when dealing with e.g. login sounds. It needs to be done at a lower level.

If these fixes override the specific code I put in place to disable volume save/restore with PulseAudio, then they are very much a regression on the intended behaviour, regardless if they appear to solve the problem. Problems should be fixed in the correct layer, not worked around. Workarounds lead to confusion and strange corner cases (like the volume being loud for the first part of the login sound and then get turned down to be quieter or vice versa).
Comment 19 gjditchfield 2011-09-17 14:16:47 UTC
In my case (currently Ubuntu Natty, pulseaudio 1:0.9.22+stable-queue-24-g67d18-0ubuntu3.1, KDE 4:4.6.5-0ubuntu1~ppa1), how would I tell if I'm having trouble with PulseAudio or not? I just want to push the volume up/down keys and have everything work.

If I understand comment 18 correctly, KMix is deliberately not restoring the volume level when I log in, and PulseAudio was restoring the volume level to 6%; now, PulseAudio is restoring it to 40% because of the "kmixctrl -s" command. Could the real problem be that PulseAudio is unaware of the volume changes that KMix has made?

(Use case 1: I log in to a KDE desktop session and observe that the audio volume is 33%. I push the "volume up" key to raise the volume to 50%. I log out of KDE and back in: the volume should be 50%.

Use case 2: I log in to a KDE desktop session and observe that the audio volume is 33%. I push the "volume up" key to raise the volume to 50%. I log out of KDE, and log in to a GNOME session: the volume should be 50%. I think that's Colin Guthrie's intent, but I'll bet we get an argument!)
Comment 20 Colin Guthrie 2011-09-17 14:26:08 UTC
kmixctrl -s certainly does not cause pulseaudio to start working and PA should very much be aware of the volume changes coming from kmix (kmix should be controlling PA directly - I presume the tabs shown in kmix are the fixed 4 that cover playback, recording, output and capture devices?)

FWIW you'll get no argument about your use cases. This should all just work exactly as you describe without kmix doing anything regarding saving/restoring the volumes.

The only thing kmix should be doing here, is listening for the key presses and then calling the appropriate PA APIs to adjust the volume.


It would be very useful if you could do the following test for me.

1. Login.
2. Kill all kmix processes.
3. Use pavucontrol to set the volume to something memorable.
4. Reboot (not 100% needed but PA will not die immediately when you log out so either reboot is the easiest instruction! - If you prefer, logout, login on text console, type "pulseaudio -k", then logout there, and switch back to the GUI login screen.)
5. Check that the volume is as you left it.

That said, I need to ensure that kmix doesn't run on login in step 5, so maybe just rename the kmix and kmixctl binaries temporarily before starting to be absolutely sure.


If this all works, then there could still be a problem in kmix, but the problem is perhaps that it's restoring things when it shouldn't rather than not restoring when it should.

If this doens't work then we need to work out why so I can fix it at the PA level.

Thanks for any help tracking this issue down fully :)
Comment 21 gjditchfield 2011-09-17 19:48:10 UTC
I killed kmix (pgrep only showed one process), used pavucontrol to change the volume from 42% to 66%, renamed /usr/bin/kmix and /usr/bin/kmixctrl, rebooted, and logged in. pavucontrol showed the volume to be 42%, and ps showed a kmix process running: "kdeinit4: kmix [default]" !

I renamed /usr/lib/kde4/libkdeinit/libkdeint4_kmix.so and .../libkdeinit4_kmixctrl.so, reset the volume, rebooted, and logged in. This time pavucontrol reported the volume to be 66%.
Comment 22 Colin Guthrie 2011-09-18 08:12:21 UTC
Awesome, thanks for testing. So it seem that with kmix completely out the way, all is well. The issue is that kmix is actually probably restoring volumes to a previously saved value, but doesn't actually save it reliably. When kmix is kept completely out the equation the volume save/restore works fine.


OK, so my final question (hopefully) is this. Is your kmix definitely compiled with PA support? Do you see the four fixed tabs? "Playback Devices", "Capture Devices", "Playback Streams" and "Capture Streams"? Or is it showing you basically one tab with all the ALSA kcontrols on it ("Master", "PCM" etc.?)
Comment 23 gjditchfield 2011-09-18 14:05:15 UTC
I see all four tabs. The binaries are from the kubuntu PPA https://launchpad.net/~kubuntu-ppa/+archive/ppa.

If you're curious about the hardware, you can find info at https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/845275
which is a bug I found during Oneiric beta testing.
Comment 24 Colin Guthrie 2011-09-18 15:42:46 UTC
OK, thanks for confirming. That means I've definitely missed some places where the volume save/restore should be prevented. FYI, all the volume save/restore code should basically not run with a PA backend - certainly that was my original intention, but I've obviously not been as thorough as I need to be there.

I'll have a hunt through the code shortly and see if I can find the problem cases.
Comment 25 Christian Esken 2011-09-18 20:45:15 UTC
I do not think that you missed any place for volume save/restore, Colin. I still tend to my explanation in comment 6, namely kmixctrl using ALSA as pulseaudio is not launched (fast enough).
Comment 26 Colin Guthrie 2011-09-19 08:18:50 UTC
(In reply to comment #25)
> I do not think that you missed any place for volume save/restore, Colin. I
> still tend to my explanation in comment 6, namely kmixctrl using ALSA as
> pulseaudio is not launched (fast enough).

Right, that would indicate a problem/race in PA code as it should always be autospawned when needed in 99.99% of setups (the times when you don't are when you're a developer like me and want to restart PA daemon a lot!)

The problem is, I cannot reproduce any races like this. My system is pretty old, but an SSD disk means that things startup OK for me :s

I guess I'll have to inject delays into the startup logic to try and reproduce the problem scenario. Gonna be tricky.
Comment 27 Thomas Tanghus 2011-11-28 16:46:23 UTC
*** Bug 287761 has been marked as a duplicate of this bug. ***
Comment 28 Christian Esken 2011-12-13 23:20:26 UTC
*** Bug 253546 has been marked as a duplicate of this bug. ***
Comment 29 Colin Guthrie 2012-04-21 17:38:58 UTC
FWIW, I found a bug recently in kmix's PA support such that kmixctl (the command line utility) would not properly detect PA as running.

Normally, when PA is used, kmix should do nothing at login (i.e. regardless of the "Restore volumes at login" option, it should do nothing as PA will handle everything). Because of the bug, kmixctl actually did mess with the volumes and it might have set the volumes incorrectly (i.e. perhaps some very old data that will ultimately only be used to restore, never store hence the 6% case.

Anyway, I'll commit the fix upstream whenever SVN or git opens, but in the meantime you can perhaps try this fix in this patch:
http://svnweb.mageia.org/packages/cauldron/kdemultimedia4/current/SOURCES/0100-Prevent-kmixctrl-running-with-PulseAudio.patch?revision=229402&view=markup
Comment 30 Christian Esken 2012-04-25 21:22:10 UTC
It's good to hear that there is a possible solution to the issue. It seemed a bit like an "impossible" situation. I believe there are more bug reports around like this. When I see them next time, I will check them and mark them as duplicate if it seems appropriate.
Comment 31 Colin Guthrie 2012-04-25 22:37:20 UTC
*** Bug 210262 has been marked as a duplicate of this bug. ***
Comment 32 Colin Guthrie 2012-04-25 22:39:02 UTC
*** Bug 298347 has been marked as a duplicate of this bug. ***
Comment 33 Colin Guthrie 2012-04-25 22:41:21 UTC
*** Bug 272844 has been marked as a duplicate of this bug. ***
Comment 34 Colin Guthrie 2012-04-25 22:44:15 UTC
So I've now committed the fix (forgot to reference the BUG sadly), so hopefully this is fixed, but let's wait for users upgrading to confirm seeing as the new version is expected any time now :)
Comment 35 Mathias Homann 2012-05-08 20:47:07 UTC
can this get some attention? it's KDE 4.8.3 by now and on two computers in my home kmix does *not* remember volume settings at all.
on my own computer I have to *unmute* sound after every login, my wife has to turn her volume down after each login... not funny at all.
Comment 36 Colin Guthrie 2012-05-09 08:23:35 UTC
@Mathias, considering I found and fixed a bug recently, I'm not sure what more you expect us to do in order to give it "more attention". Your tone does not motivate me to try and help you solve your problem - I do this for "fun" afterall!

So please provide the following information:
 1. Are you using PulseAudio
 2. Is your kmix compiled with PulseAudio support
 3. Is your Qt compiled with the GLib Main Loop

Keep in mind that if you *are* using PulseAudio, kmix is not supposed to save/restore volumes. That job is left to PA. The recent problem fixed in 4.8.3 was actually a result of kmix restoring the wrong volumes (as it had never saved them) rather than just letting PA do it's thing.

So please provide more information about your setup rather than just complaining. There are many factors involved.
Comment 37 Mathias Homann 2012-05-09 08:30:47 UTC
I am using pulseaudio, my kmix has PA support.
How can I tell about QT and the glib main loop thing?


I didn't actually know about the fact that since PA kmix is not *supposed* to save/restore volumes... so how does one save the volume settings with PA now?
Comment 38 Colin Guthrie 2012-05-09 08:43:55 UTC
Well, PA should just save/restore volumes without any configuration (including per-application volumes)

If you see PulseAudio style devices in kmix (i.e. four fixed tabs) then you can be quite sure about the Glib Mainloop thing (it's pretty much how most Qt's are built so it's generally speaking not an issue).

Can you run kdebugdialog and tick all the kmix bug options and then do:
  kmixctrl -r
This should give some nice debug output...

Actually looking at this here I do see some interesting things.... (forgive the inline paste):

kmixctrl(23716)/kmix MixerToolBox::initMixerInternal: "Sound drivers supported: PulseAudio + ALSA + OSS + MPRIS2
Sound drivers used: PulseAudio"
Total number of detected Mixers:  4
kmixctrl(23716)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Playback_Devices:1"
kmixctrl(23716)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.
kmixctrl(23716)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.
kmixctrl(23716)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_sink_volume_by_index() failed 
kmixctrl(23716)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_sink_volume_by_index() failed 
kmixctrl(23716)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Capture_Devices:1"
kmixctrl(23716)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.
kmixctrl(23716)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_source_volume_by_index() failed 
kmixctrl(23716)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Playback_Streams:1"
kmixctrl(23716)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.
kmixctrl(23716)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_sink_input_volume() failed 
kmixctrl(23716)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Capture_Streams:1"
Running Mixer_Backend destructor 
Running Mixer_Backend destructor 
Running Mixer_Backend destructor 
Running Mixer_Backend destructor 

The messages are mostly correct, but the debug that says: "pa_context_set_sink_input_volume() failed" is odd as the call should never be called in the first place...

Will look tonight.
Comment 39 Mathias Homann 2012-05-09 09:22:20 UTC
hm.

I *do* see the usual 4 device tabs in kmix...

have to do the debug thing later today, am not at the computer in question...
Comment 40 Mathias Homann 2012-05-09 16:53:14 UTC
here's what I get as debug output:

http://paste.opensuse.org/5545756

on the other hand, http://susepaste.org/15011245 looks like kmix is built with the required options...

I'm puzzled.
Comment 41 Colin Guthrie 2012-05-09 18:54:54 UTC
That's basically what would happen in KDE versions prior to 4.8.3. I've looked at the tag in SVN and it definitely contains the commit I did... Are you 100% certain you've got kmix 4.8.3 (it was only a released a few days ago).
Comment 42 Mathias Homann 2012-05-09 19:29:45 UTC
...

i still have kmix 4.7.2 here, dont know how much you know about opensuse, packaging policies, and secondary repositories... packman still has kmix 4.7.2 so it gets downgraded all the time.
Comment 43 Colin Guthrie 2012-05-09 21:12:30 UTC
(In reply to comment #35)
> can this get some attention? it's KDE 4.8.3 by now and on two computers in
> my home kmix does *not* remember volume settings at all.

(In reply to comment #42)
> i still have kmix 4.7.2 here

Please in future don't provide contradictory information. You implied you were using 4.8.3 on both your machines when the bug report specifically menitoned the bug was fixed in that version then complained about it not being fixed yet... then it turns our you're on 4.7.2... this is not a downstream tracker, but an upstream one. I'm not really interested in downstream packaging policy etc. You should likely request that opensuse updates their packages like was done on fedora: https://bugzilla.redhat.com/show_bug.cgi?id=657373 (note I'm not a RH guy, just happened to notice that bug and let them know - you should do the same for opensuse).

I'm going to mark this bug as fixed. Please reopen if you can reproduce with *latest* kmix.
Comment 44 Mark 2012-05-15 22:47:41 UTC
Hi,

Sorry for dropping in this bug, but i can verify that the issue is still here. And yes, with KDE 4.8.3.

Take a look at my kmixctrl:
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: Looking for mixers with the :  "PulseAudio"  driver
kmixctrl(1425)/kmix Mixer_PULSE::Mixer_PULSE: Probing for PulseAudio...
kmixctrl(1425)/kmix sink_cb: Got some info about sink:  "Barts HDMI Audio [Radeon HD 6800 Series] Digitaal stereo (HDMI)"
kmixctrl(1425)/kmix sink_cb: Got some info about sink:  "Intern geluid Analoog stereo"
kmixctrl(1425)/kmix source_cb: Ignoring Monitor Source:  Monitor of Barts HDMI Audio [Radeon HD 6800 Series] Digitaal stereo (HDMI)
kmixctrl(1425)/kmix source_cb: Ignoring Monitor Source:  Monitor of Intern geluid Analoog stereo
kmixctrl(1425)/kmix source_cb: Got some info about source:  "Intern geluid Analoog stereo"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "ConsoleKit Session /org/freedesktop/ConsoleKit/Session1"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "KMix KDE 4"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "XSMP Session on KDE as 10ef125dbd9000133712051700000008640010"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "libphonon"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "KMix KDE 4"
kmixctrl(1425)/kmix client_cb: Got some info about client:  "kmix-probe"
kmixctrl(1425)/kmix ext_stream_restore_read_cb: Initialising restore rule for new user:  "Event Sounds"
kmixctrl(1425)/kmix Mixer_PULSE::Mixer_PULSE: PulseAudio probe complete.
kmixctrl(1425)/kmix Mixer_PULSE::connectToDaemon: Attempting connection to PulseAudio sound daemon
kmixctrl(1425)/kmix Mixer_PULSE::Mixer_PULSE: PulseAudio status:  Active
kmixctrl(1425)/kmix MixDevice::init: MixDevice::init() _id= "alsa_output.pci-0000_01_00.1.hdmi-stereo"
kmixctrl(1425)/kmix MixDevice::addToPool: MixDevice::init() id= "alsa_output.pci-0000_01_00.1.hdmi-stereo@"
kmixctrl(1425)/kmix MixDevice::init: MixDevice::init() _id= "alsa_output.pci-0000_00_14.2.analog-stereo"
kmixctrl(1425)/kmix MixDevice::addToPool: MixDevice::init() id= "alsa_output.pci-0000_00_14.2.analog-stereo@"
kmixctrl(1425)/kmix Mixer_PULSE::open: Using PulseAudio for mixer:  "Playback Devices"
kmixctrl(1425)/kmix Mixer::openIfValid: Mixer::open() detected master:  "alsa_output.pci-0000_01_00.1.hdmi-stereo"
kmixctrl(1425)/kmix MixerToolBox::possiblyAddMixer: Added card  "PulseAudio::Playback_Devices:1"
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: Success! Found a mixer with the :  "PulseAudio"  driver
kmixctrl(1425)/kmix MixDevice::init: MixDevice::init() _id= "alsa_input.pci-0000_00_14.2.analog-stereo"
kmixctrl(1425)/kmix MixDevice::addToPool: MixDevice::init() id= "alsa_input.pci-0000_00_14.2.analog-stereo@"
kmixctrl(1425)/kmix Mixer_PULSE::open: Using PulseAudio for mixer:  "Capture Devices"
kmixctrl(1425)/kmix Mixer::openIfValid: Mixer::open() detected master:  "alsa_input.pci-0000_00_14.2.analog-stereo"
kmixctrl(1425)/kmix MixerToolBox::possiblyAddMixer: Added card  "PulseAudio::Capture_Devices:1"
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: Success! Found a mixer with the :  "PulseAudio"  driver
kmixctrl(1425)/kmix Mixer_PULSE::open: Using PulseAudio for mixer:  "Playback Streams"
kmixctrl(1425)/kmix MixerToolBox::possiblyAddMixer: Added card  "PulseAudio::Playback_Streams:1"
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: Success! Found a mixer with the :  "PulseAudio"  driver
kmixctrl(1425)/kmix Mixer_PULSE::open: Using PulseAudio for mixer:  "Capture Streams"
kmixctrl(1425)/kmix MixerToolBox::possiblyAddMixer: Added card  "PulseAudio::Capture_Streams:1"
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: Success! Found a mixer with the :  "PulseAudio"  driver
Running Mixer_Backend destructor 
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
kmixctrl(1425)/kmix Mixer::setGlobalMaster: ref_card= "PulseAudio::Playback_Devices:1" , ref_control= "alsa_output.pci-0000_01_00.1.hdmi-stereo" , preferred= true                                                                                                                     
kmixctrl(1425)/kmix Mixer::setGlobalMaster: Mixer::setGlobalMaster() card= "PulseAudio::Playback_Devices:1"  control= "alsa_output.pci-0000_01_00.1.hdmi-stereo"                                                                                                                       
kmixctrl(1425)/kmix MixerToolBox::initMixerInternal: "Sound drivers supported: PulseAudio + ALSA + OSS + MPRIS2                                                                                                                                                                        
Sound drivers used: PulseAudio"                                                                                                                                                                                                                                                        
Total number of detected Mixers:  4                                                                                                                                                                                                                                                    
kmixctrl(1425)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Playback_Devices:1"                                                                                                                                                                                       
kmixctrl(1425)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.                                                                                                        
kmixctrl(1425)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.                                                                                                        
kmixctrl(1425)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_sink_volume_by_index() failed                                                                                                                                                                                         
kmixctrl(1425)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_sink_volume_by_index() failed                                                                                                                                                                                         
kmixctrl(1425)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Capture_Devices:1"                                                                                                                                                                                        
kmixctrl(1425)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack). Ignoring.                                                                                                        
kmixctrl(1425)/kmix Mixer_PULSE::writeVolumeToHW: pa_context_set_source_volume_by_index() failed                                                                                                                                                                                       
kmixctrl(1425)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Playback_Streams:1"                                                                                                                                                                                       
kmixctrl(1425)/kmix MixSet::read: MixSet::read() of group  "MixerPulseAudio::Capture_Streams:1"                                                                                                                                                                                        
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       
Running Mixer_Backend destructor                                                                                                                                                                                                                                                       

The interesting one: "kmixctrl(1425)/kmix MixDevice::read: MixDevice::read(): This MixDevice does not permit volume restoration (i.e. because it is handled lower down in the audio stack)."

KMix version:
Qt: 4.8.1                                                                                                                                                                                                                                                                              
KDE Development Platform: 4.8.3 (4.8.3)                                                                                                                                                                                                                                                
KMix: 4.1                                                                                                                                                                                                                                                                              

The issue only seems to happen at boot and first login. Then KMix start up with a very low volume and an error (which i reported here https://bugs.kde.org/show_bug.cgi?id=300100).

If you need any more information or want me to test out patches, please feel free to ask :)

Cheers,
Mark
Comment 45 Colin Guthrie 2012-05-15 23:44:10 UTC
@Mark: Actually shows things working as intended. When used on top of PulseAudio, KMix should NOT restore any volumes. Although this was the title of this bug report, it's actually not really representative of what the ultimate problem was which was that kmixctrl wasn't detecting PulseAudio and was "restoring" volumes from invalid or outdated initial data (as it was never really saved). This basically made it look like the volume was not being restored on login, but in actual fact it was being *reset* on every login.

PulseAudio should be restoring the volumes and if it does not, then the problem lies there and not in anything KDE related. You do have to make sure no other process is doing any kind of volume restoration (e.g. aumix).

(of course the error "pa_context_set_sink_volume_by_index() failed" is interesting in itself and I do need to look at that but it's different from the root cause of this bug. I'll leave this bug open until I take a look at that specific issue.
Comment 46 Colin Guthrie 2012-05-16 08:58:59 UTC
Git commit a4df93aee07fde55e3d9200d2cde0063e7b68a33 by Colin Guthrie.
Committed on 16/05/2012 at 10:54.
Pushed by cguthrie into branch 'master'.

pulse: More fixes relating to volume restoration via kmixctrl.

When we fail to read the values from a config file, do not attempt to then write them
to the sinks and sources anyway.

M  +34   -30   core/mixdevice.cpp
M  +2    -2    core/mixdevice.h
M  +5    -1    core/mixer.cpp
M  +14   -4    core/mixset.cpp
M  +2    -2    core/mixset.h

http://commits.kde.org/kmix/a4df93aee07fde55e3d9200d2cde0063e7b68a33
Comment 47 Colin Guthrie 2012-05-16 08:58:59 UTC
Git commit 1749da9d029dc0fe42604ec9bf17d45abac74428 by Colin Guthrie.
Committed on 16/05/2012 at 10:58.
Pushed by cguthrie into branch 'master'.

pulse: Use the same Glib event loop detection as in phonon.

This is a little bit neater IMO and does the same job.

M  +2    -3    backends/mixer_pulse.cpp

http://commits.kde.org/kmix/1749da9d029dc0fe42604ec9bf17d45abac74428
Comment 48 Colin Guthrie 2012-05-16 09:00:16 UTC
@Mark The above commits should prevent any calls to the actual h/w writing code. I'm not sure it will solve your problems completely (it could ultimately be a problem outside of kmix) but it should certainly solve this particular bug.
Comment 49 Mark 2012-05-16 12:00:21 UTC
(In reply to comment #48)
> @Mark The above commits should prevent any calls to the actual h/w writing
> code. I'm not sure it will solve your problems completely (it could
> ultimately be a problem outside of kmix) but it should certainly solve this
> particular bug.

Thank you for that. I'm guessing that fix will be in KDE 4.9.0 but not in KDE 4.8.4 right? (if there is even going to be a 4.8.4 release).
Comment 50 Colin Guthrie 2012-05-16 12:38:23 UTC
I'm not sure if there will be a 4.8.4 or not (or how it'll be done considering the git migration), but if I hear of it happening, I'll be sure to cherry pick the fix. Other than that, yeah, 4.9 I guess (tho' you can ask your friendly arch packager to include the patch in their package in the short term)
Comment 51 Colin Guthrie 2012-07-22 19:32:57 UTC
Git commit 899783ada273dea65a4fb615c16f44a382e826b0 by Colin Guthrie.
Committed on 16/05/2012 at 10:58.
Pushed by cguthrie into branch 'KDE/4.8'.

pulse: Use the same Glib event loop detection as in phonon.

This is a little bit neater IMO and does the same job.
(cherry picked from commit 1749da9d029dc0fe42604ec9bf17d45abac74428)

M  +2    -3    backends/mixer_pulse.cpp

http://commits.kde.org/kmix/899783ada273dea65a4fb615c16f44a382e826b0
Comment 52 kostas213@gmail.com 2012-08-04 20:21:00 UTC
I am using Arch Linux 64-bit with ALSA (no PulseAudio) with KDE 4.8.4 and the bug still exists. If I uncheck the check box "Restore volumes on login" everything works fine, but if checked it doesn't.
Comment 53 Philipp A. 2013-10-11 07:04:09 UTC
KDE 4.11 here, pulseaudio and KDE installed from the official Archlinux repos, and i gave this problem.
Comment 54 Philipp A. 2013-10-11 07:04:56 UTC
*have, not “gave”, sorry
Comment 55 Cédric Bellegarde 2014-03-30 08:41:37 UTC
ArchLinux, KDE 4.12.97, pulseaudio:

$ kmixctrl --save
// Change volume in applet
$ kmixctrl --restore
// Sound not restored

How can i help with this? Was working in KDE 4.12
Comment 56 Christian Esken 2014-04-04 14:59:58 UTC
C´edric:


$ kmixctrl --save
 // Change volume in applet

Does this means, the volume changes, when you call "kmixctrl --save"?!? This would be weird.

 $ kmixctrl --restore
 // Sound not restored

So restore behavior is OK. KMix does NOT restore volume for Pulseaudio, as intended.
Comment 57 Giorgio 2014-04-06 21:08:18 UTC
Same problem. No way to set volume on login.
At the end of login I have always the same volume I had at logout. Checking or not "Restore volumes on login" in KMix don't affect this behaviour.

KDE 4.11.2
OpenMandriva Linux 2013.0, 64 bit
Comment 58 Colin Guthrie 2014-04-07 08:42:51 UTC
(In reply to comment #57)
> Same problem. No way to set volume on login.
> At the end of login I have always the same volume I had at logout. Checking
> or not "Restore volumes on login" in KMix don't affect this behaviour.

This is expected behaviour.

On a PulseAudio system, the volume is saved and restored. If you want a specific volume on login, you should set your volumes as desired, wait about 5s and then copy your ~/.pulse/*-device-volumes.tdb file to a known filename, then have a little init/login script that restores this file prior to pulseaudio starting (probably the best way is to rename /usr/bin/pulseaudio to /usr/bin/pulseaudio-bin and then write a replacement /usr/bin/pulseaudio bash script to do the copy and then exec the real PA. Something like:

#!/bin/bash

if [ -f $HOME/.pulse/preset-volumes.tdb ]; then
  cp -f $HOME/.pulse/preset-volumes.tdb $HOME/.pulse/$(< /etc/machine-id)-device-volumes.tdb
fi
exec /usr/bin/pulseaudio-real "$@"


That should do the trick I think.

This is certainly not something that is considered standard in PA, but it wouldn't be too hard to add support ot it. e.g. module-stream-restore for example has a fallback_table= argument to prime the data in the absense of saved data, but this still doesn't do what you want as user changes are still saved and restored.

There is the restore_volume and restore_muted arguments to module-device-restore (the module which owns/manages the device-volumes.tdb file) which prevents it setting the volumes on restore, but then you rely on ALSA saving and restoring the volumes.

Depending if the Mandriva folks have switched over to the alsactl state daemon or not, you could relatively easily use this approach. Namely prevent the alsa-store.service in systemd (systemctl mask alsa-store.service) and then only call "alsactl store" (as root) when you are happy with your volumes. That should also acheive the desired result.


Hope that helps.
Comment 59 Cédric Bellegarde 2014-04-07 11:57:45 UTC
For Archlinux users, it's not a pulseaudio issue but an alsa issue....

You need to install alsa-utils...
Comment 60 Giorgio 2014-04-07 13:09:09 UTC
Thanks for fast answer.
 I don't know if in OpenMandriva 2013 Pulse Audio is used and proposed solution is a bit too difficult for me.
I've alsa-utils installed but it's not clear how tu use it.
I opened a bug in OpenMadriva with link to this thread.
Comment 61 Colin Guthrie 2014-04-07 13:13:17 UTC
(In reply to comment #60)
> Thanks for fast answer.
>  I don't know if in OpenMandriva 2013 Pulse Audio is used and proposed
> solution is a bit too difficult for me.
> I've alsa-utils installed but it's not clear how tu use it.
> I opened a bug in OpenMadriva with link to this thread.

Note that Cédric's answer was about getting things to work as intended (i.e. volumes are saved throught use and then restored to the last used value on next login) where as your problem seems to be about restoring volumes to a user-defined known-good state at each login (i.e. not the last used state) - assuming I've understood correctly!! So these appear to be different issues.

Hope that helps.
Comment 62 Giorgio 2014-04-08 11:18:43 UTC
(In reply to comment #61)
> (In reply to comment #60)
>...  where as your problem seems to be about restoring volumes to a
> user-defined known-good state at each login (i.e. not the last used state) -
> assuming I've understood correctly!! So these appear to be different issues.
> 
> Hope that helps.
You've understood perfectly. Do you think it's better if I open a new thread?
Comment 63 qwerty 2014-04-08 21:47:45 UTC
it works for me lel


On Tue, Apr 8, 2014 at 4:18 AM, Giorgio <gio_6b@yahoo.it> wrote:

> https://bugs.kde.org/show_bug.cgi?id=249180
>
> --- Comment #62 from Giorgio <gio_6b@yahoo.it> ---
> (In reply to comment #61)
> > (In reply to comment #60)
> >...  where as your problem seems to be about restoring volumes to a
> > user-defined known-good state at each login (i.e. not the last used
> state) -
> > assuming I've understood correctly!! So these appear to be different
> issues.
> >
> > Hope that helps.
> You've understood perfectly. Do you think it's better if I open a new
> thread?
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
>
Comment 64 Christoph Feck 2014-04-25 11:50:56 UTC
Marking as fixed again. Please create a new ticket, if you see this again, because the cause is most probably unrelated then.