Why does pulseaudio deliberately ignore my sound card?

After installing the Gnome desktop on my new NetBSD machine, I was over the moon about having the sleekest NetBSD system I'd ever used by a long way, approaching the nearly immaculate out-of-the-box experience of recent Fedora or OpenSolaris distributions. However, I could not get any sound from the video player totem, the messaging client Pidgin or even the file browser nautilus. Since pulseaudio is in charge of sound output nowadays, it was the place to look for the cause of the problem.

In the default configuration, pulseaudio uses a module called module-hal-detect which has an interesting check to "detect" only the audio device which happens to be assigned index 0 by hald. The commit comment admits that's what it's doing but leaves us in the dark as to why except that it's also done for ALSA. On my machine, device 0 happens to be the HDMI sound interface of my video card which I'd want to use if I watched a movie on a digitally connected TV. My regular sound card gets assigned device number 1 and hence pulseaudio never becomes aware of it.

After recognising the cause, the problem was easily fixed by commenting out the offending test:

--- src/modules/module-hal-detect.c.orig        2009-01-12 23:10:34.000000000 +0000
+++ src/modules/module-hal-detect.c
@@ -253,7 +253,7 @@ static int hal_oss_device_is_pcm(LibHalC
             goto finish;
 
     device = libhal_device_get_property_int(context, udi, "oss.device", error);
-    if (dbus_error_is_set(error) || device != 0)
+    if (dbus_error_is_set(error) /* || device != 0 */)
         goto finish;
 
     r = 1;
Now pulseaudio happily recognises my sound card, and after selecting the newly appeared device as my default, I finally have sound -- but not before wiping my ~/.pulse directory which still mapped the output of all the programs I had used to the old device (which used to be the default) with no obvious GUI to change it (it's stored in the gdbm database ~/.pulse/<host>:stream-volumes.<arch>--<os>.gdbm if you must know).

Now I have to admit that I'm slightly behind because I'm using pulseaudio 0.9.14 which is currently in pkgsrc instead of the current version 0.9.15. In the meantime, two things have happened: First, someone had my exact problem so (while still owing an explanation for the check in the first place) module-hal-detect got an argument subdevs that makes it recognise all sound cards in the sysetem and which was later renamed to subdevices. Second, the entire hal support was ripped outdeprecated in line with the abandonment of hald in favour of udev, which I don't know anything about including whether it will work on NetBSD. Oh well, something to look forward to in pulseaudio 0.9.16 I guess...

Comments