Bug 309334

Summary: Mute key doesn't mute
Product: kmix Reporter: Thiago Macieira <thiago>
Component: QA and TestingAssignee: Christian Esken <esken>
Status: RESOLVED FIXED    
Severity: major CC: daniel.eckl
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.10

Description Thiago Macieira 2012-10-31 18:25:00 UTC
The mute button is not muting the sound.

Reproducible: Always

Steps to Reproduce:
1. Press the mute button on the keyboard

Actual Results:  
OSD shows with the volume as it was. The loudspeaker indicator does not change, as it used to. The sound is not muted.

Expected Results:  
OSD shows with some indication that sound was muted, like greying out the loudspeaker icon. The sound is muted.

pulseaudio-1.1-9, on Fedora 17.

This is possibly related to bug 308300, but I cannot reproduce the issue reported there. If I click the mute button on the KMix interface, then sound is muted and the volume level goes down all the way to zero. Note also that clicking the button again unmutes, but does *not* bring the sound level back to where it was.
Comment 1 Thiago Macieira 2012-10-31 18:31:29 UTC
I also get this on ~/.xsession-errors. Maybe it's relevant:

kglobalaccel(1271) KGlobalAccelImpl::x11Event: Got XKeyPress event
kglobalaccel(1271) GlobalShortcutsRegistry::keyPressed: "Volume Mute" = "mute"
kmix(14267) Mixer::commitVolumeChange: commiting announces the change of:  "alsa_output.pci-0000_00_1b.0.analog-stereo"
kmix(14267) OSDWidget::setCurrentVolume: Meter is visible:  true
kmix(14267) ControlManager::announce: Listener  "OSDWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ViewSliders::controlsChange: NOW I WILL REFRESH VOLUME LEVELS. I AM  "PulseAudio.Dispositivos_de_reprodução.1.default"
kmix(14267) ControlManager::announce: Listener  "ViewSliders.PulseAudio::Playback_Devices:1"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) Volume::hasSwitch: Allow playback switch read once
kmix(14267) ControlManager::announce: Listener  "ViewDockAreaPopup"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Listener  "KMixDockWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.commitVolumeChange()"
Comment 2 Thiago Macieira 2012-10-31 18:33:18 UTC
If I click the mute button on the mixer UI, .xsession-error contains:

kmix(14267) Mixer::commitVolumeChange: commiting announces the change of:  "alsa_output.pci-0000_00_1b.0.analog-stereo"
kmix(14267) OSDWidget::setCurrentVolume: Meter is visible:  true
kmix(14267) ControlManager::announce: Listener  "OSDWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ViewSliders::controlsChange: NOW I WILL REFRESH VOLUME LEVELS. I AM  "PulseAudio.Dispositivos_de_reprodução.1.default"
kmix(14267) ControlManager::announce: Listener  "ViewSliders.PulseAudio::Playback_Devices:1"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) Volume::hasSwitch: Allow playback switch read once
kmix(14267) ControlManager::announce: Listener  "ViewDockAreaPopup"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Listener  "KMixDockWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.commitVolumeChange()"
kded(1262)/kmix Mixer_Backend::readSetFromHW: Announcing the readSetFromHW()
kded(1262)/kmix ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.fromHW"
kded(1262)/kmix Mixer_Backend::readSetFromHW: Announcing the readSetFromHW()
kded(1262)/kmix ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.fromHW"
kmix(14267) Mixer_Backend::readSetFromHW: Announcing the readSetFromHW()
kmix(14267) OSDWidget::setCurrentVolume: Meter is visible:  true
kmix(14267) ControlManager::announce: Listener  "OSDWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ViewSliders::controlsChange: NOW I WILL REFRESH VOLUME LEVELS. I AM  "PulseAudio.Dispositivos_de_reprodução.1.default"
kmix(14267) ControlManager::announce: Listener  "ViewSliders.PulseAudio::Playback_Devices:1"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) Volume::hasSwitch: Allow playback switch read once
kmix(14267) ControlManager::announce: Listener  "ViewDockAreaPopup"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Listener  "KMixDockWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.fromHW"
kmix(14267) Mixer_Backend::readSetFromHW: Announcing the readSetFromHW()
kmix(14267) OSDWidget::setCurrentVolume: Meter is visible:  true
kmix(14267) ControlManager::announce: Listener  "OSDWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ViewSliders::controlsChange: NOW I WILL REFRESH VOLUME LEVELS. I AM  "PulseAudio.Dispositivos_de_reprodução.1.default"
kmix(14267) ControlManager::announce: Listener  "ViewSliders.PulseAudio::Playback_Devices:1"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) Volume::hasSwitch: Allow playback switch read once
kmix(14267) ControlManager::announce: Listener  "ViewDockAreaPopup"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Listener  "KMixDockWidget"  is interested in  "PulseAudio::Playback_Devices:1" ,  "Volume"
kmix(14267) ControlManager::announce: Announcing  "Volume"  for  "PulseAudio::Playback_Devices:1"  by  "Mixer.fromHW"
Comment 3 Christian Esken 2012-11-03 00:37:26 UTC
In current trunk the mute button is under refactoring and heavily broken. I guess you are using trunk, do you?
Comment 4 Thiago Macieira 2012-11-03 01:33:29 UTC
Yes, this is trunk.
Comment 5 Christian Esken 2012-11-12 21:19:46 UTC
*** Bug 309336 has been marked as a duplicate of this bug. ***
Comment 6 Christian Esken 2012-11-12 21:22:21 UTC
Git commit 4f7ac8db6514d4f539521a45a5d3d45e9c193e05 by Christian Esken.
Committed on 12/11/2012 at 22:20.
Pushed by esken into branch 'master'.

Fix volume switch for controls with a virtual/simulated mute switch.

M  +38   -11   backends/mixer_alsa9.cpp
M  +7    -0    core/mixdevice.cpp
M  +1    -0    core/mixdevice.h
M  +4    -1    core/volume.cpp
M  +11   -36   core/volume.h

http://commits.kde.org/kmix/4f7ac8db6514d4f539521a45a5d3d45e9c193e05
Comment 7 Christian Esken 2012-11-12 21:45:51 UTC
Volume switch has undergone a redesign to allow a mute switch for ALL playback controls, even those w/o a hardware playback switch. It should now work again.

It requires a change in all backends, for two reasons:
 - They must respect that there is a playback switch that does not exist according to their knowledge.
 - They must not feed back the 0 volume back to KMix, otherwise after unmuting the volume would stay at 0.

I left the implementation detail to the Backends, as they know best how to mute a control. Setting a volume to 0 might not always be the best solution. Backend state:
 - ALSA : Implemented, and tested succesfully against alsamixer.
 - Pulseaudio: As far as I saw, each playback control has a mute switch. So it should simply continue working. Also it seems to works for me. I have tested against pavucontrol.
 - MPRIS2 : TODO
 - OSS : Not yet implemented. Strangely enough, it seems to work w/o explicitely cahngeing the backend.
 - Solaris : Misses maintainer
 - OSSv4 : Misses maintainer
Comment 8 Christian Esken 2012-11-12 22:15:55 UTC
Git commit c742a9b7eebc2f2288a52385fc3dba89cf83960c by Christian Esken.
Committed on 12/11/2012 at 23:12.
Pushed by esken into branch 'master'.

Implement virtual mute switch for MPRIS2 backend.

M  +42   -34   backends/mixer_mpris2.cpp
M  +1    -0    backends/mixer_mpris2.h

http://commits.kde.org/kmix/c742a9b7eebc2f2288a52385fc3dba89cf83960c
Comment 9 Christian Esken 2012-11-12 22:18:11 UTC
Support in MPRIS2 now also added. All viable backends have now been adapted.

Please test, especially I would need feedback from Pulseaudio users.
Comment 10 Daniel Eckl 2012-11-14 20:23:19 UTC
No change for pulseaudio here running Kubuntu 12.10, KDE 4.9.3 and kmix git from a few minutes ago (20121114). Pressing mute button only shows the OSD, but does not mute.
Comment 11 Daniel Eckl 2012-11-14 20:43:51 UTC
Some debug output that might be helpful:

in .xsession-errors, when i press mute, I get this line:
QDBusConnection: error: could not send signal path "/Mixers/PulseAudio::Playback_Devices:1" interface "org.kde.KMix.Mixer" member "controlChanged": Invalid object path: /Mixers/PulseAudio::Playback_Devices:1

I'm not experienced in dbus, but I don't see any "Pulseaudio" object below "Mixers":

> qdbus org.kde.kmix /Mixers/Pulseaudio
Error: org.freedesktop.DBus.Error.UnknownObject
No such object path '/Mixers/Pulseaudio'

The contents of "Mixers" object is:

> qdbus org.kde.kmix /Mixers
property read QString org.kde.KMix.MixSet.currentMasterControl
property read QString org.kde.KMix.MixSet.currentMasterMixer
property read QStringList org.kde.KMix.MixSet.mixers
property read QString org.kde.KMix.MixSet.preferredMasterControl
property read QString org.kde.KMix.MixSet.preferredMasterMixer
signal void org.kde.KMix.MixSet.mixersChanged()
method void org.kde.KMix.MixSet.setCurrentMaster(QString mixer, QString control)
method void org.kde.KMix.MixSet.setPreferredMaster(QString mixer, QString control)
method QDBusVariant org.freedesktop.DBus.Properties.Get(QString interface_name, QString property_name)
method QVariantMap org.freedesktop.DBus.Properties.GetAll(QString interface_name)
method void org.freedesktop.DBus.Properties.Set(QString interface_name, QString property_name, QDBusVariant value)
method QString org.freedesktop.DBus.Introspectable.Introspect()
method QString org.freedesktop.DBus.Peer.GetMachineId()
method void org.freedesktop.DBus.Peer.Ping()
Comment 12 Christian Esken 2012-11-14 20:57:49 UTC
Git commit e89db3c5097092347ec9b25780f7b2ecf05b11f8 by Christian Esken.
Committed on 14/11/2012 at 21:56.
Pushed by esken into branch 'master'.

Fix toggle mute.

M  +1    -1    core/mixdevice.cpp

http://commits.kde.org/kmix/e89db3c5097092347ec9b25780f7b2ecf05b11f8
Comment 13 Christian Esken 2012-11-14 21:03:32 UTC
It looks like yesterday I fixed a different mute bug. Sorry about that. ;-)
It should work now. It was a stupid typo. Another test would still be appreciated.

The DBUS thing is bug 308014, which I fixed today.
Comment 14 Daniel Eckl 2012-11-14 21:06:41 UTC
Tested and bug is fixed for me. Thanks for looking into this so fast :)
Comment 15 Christian Esken 2012-11-14 21:15:27 UTC
Well, the beta is due tomorrow. I am trying to fix as much as I can until then.
Thanks for the test. Closing ticket.