These are the ramblings of Matthijs Kooijman, concerning the software he hacks on, hobbies he has and occasionally his personal life.
Most content on this site is licensed under the WTFPL, version 2 (details).
Questions? Praise? Blame? Feel free to contact me.
My old blog (pre-2006) is also still available.
See also my Mastodon page.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
(...), Arduino, AVR, BaRef, Blosxom, Book, Busy, C++, Charity, Debian, Electronics, Examination, Firefox, Flash, Framework, FreeBSD, Gnome, Hardware, Inter-Actief, IRC, JTAG, LARP, Layout, Linux, Madness, Mail, Math, MS-1013, Mutt, Nerd, Notebook, Optimization, Personal, Plugins, Protocol, QEMU, Random, Rant, Repair, S270, Sailing, Samba, Sanquin, Script, Sleep, Software, SSH, Study, Supermicro, Symbols, Tika, Travel, Trivia, USB, Windows, Work, X201, Xanthe, XBee
I've been configuring my new laptop (more on that later) and this time I've tried to get the volume hotkeys working properly with Pulseaudio. On a default Debian Squeeze installation, the volume hotkeys are processed by (the media-keys plugin of) gnome-settings-daemon (1). The good news is that Gnome has switched over to using pulseaudio by default (and even removed support for plain ALSA). However, Debian does not want to force users to use pulseaudio. So the bad news is that Debian has disabled this pulseaudio support in gnome-settings-daemon and has a patch to use the ALSA mixer (via GStreamer).
Normally, it shouldn't matter much which mixer you use, as long as they
work. However, I'm using two different sound cards on my laptop: The
builtin one for on the road and an external USB sound card when I'm at
home (to get a S/PDIF output). So I need pulseaudio to route my audio to
the right place, and I want my volume controls to control the same card
as well. Note that gnome-volume-control
, the GUI to control your
volums is installed in two flavours by Debian (Pulseaudio and
GStreamer), and the right one is started by a wrapper script depending
on whether Pulse is running.
Fortunately, the Debian patch is somewhat configurable: You can select a
different mixer device through gconf. To get at that configuration, use
gconf-editor
and browse to /desktop/gnome/sound/default_mixer_device
.
Set this value in the form of "element:device
", where element
selects the gstreamer plugin to use, and device
sets its "device"
property. I initially tried using the "pulsemixer
" element (in the
form
"pulsemixer:alsa_output.usb-0ccd_USB_Audio-00-Aureon51MkII.analog-stereo
"),
but that only allowed me to specify a specific Pulseaudio sink, not
"whatever-is-default").
So, instead, I settled for using the "alsamixer
" gstreamer plugin,
together with the Pulseaudio ALSA plugin (the same one you use to
redirect ALSA applications to Pulseaudio). For this to work, it's
important that you redirect ALSA applications to pulse using the
following in your /etc/asound.conf
or your ~/.asoundrc
:
pcm.!default.type pulse
ctl.!default.type pulse
This makes sure that not just audio streams (pcm
) but also mixer
controls (ctl
) are redirected to Pulseaudio. Now, set the
/desktop/gnome/sound/default_mixer_device
gconf value to the
following:
alsamixer:default
This should make sure that your volume keys work with the device
selected as default in Pulseaudio (through pavucontrol
or
gnome-volume-control
for example). It seems this behaviour relies on
the fact that gnome-settings-daemon only keeps the mixer controls open
for a few seconds, allowing the Pulseaudio ALSA plugin to select the
right pulseaudio sink to control everytime the mixer is reopened (so it
needs a few seconds of not pressing the volume hotkeys after changing
the default device).
By the way, it seems that in the next version of Gnome (and/or Debian) this problem wil probably be fixed out of the box, since the 2.93 packages in Debian experimental have Pulseaudio support enabled (haven't tested them, though).
Hopefully this helps someone else out there struggling with the same problem...
(1): You might have noticed that I'm talking about Gnome here. I case
you wondered, I've actually started to use parts of Gnome for daily use
on my laptop. I'm still using Awesome as my primary window manager
and I'm not using gnome-panel
, so I haven't suddenly become a GUI addict
all of the sudden ;-)
You are my hero! I have been trying to figure this out for what seems like a week now! Looks like I won't have to lose sleep anymore. Thanks a million for writing about this. I just wish Debian hasn't patched out the PulseAudio support by default.
Thank you very much for this :)
Your are my hero as well! After ages working erratically, my sound buttons finally work as they should. I just set "/desktop/gnome/sound/defaultmixerdevice" to "gnome-volume-control.gstreamer:default". Thanks!
Comments are closed for this story.