[pulseaudio-discuss] ALSA sink enumeration and multiple devices/subdevices

Stephen Warren swarren at nvidia.com
Mon Aug 23 12:40:28 PDT 2010


Recent NVIDIA GPUs include an audio controller that hosts a number of
different ALSA PCM objects. For example, consider the following output
from "aplay -L":

hdmi:CARD=NVidia_1,DEV=0
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output
hdmi:CARD=NVidia_1,DEV=1
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output
hdmi:CARD=NVidia_1,DEV=2
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output
hdmi:CARD=NVidia_1,DEV=3
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output

Each of these may correspond to a specific connector on the graphics board.

However, "pactl list" and various other mechanisms show only a single Pulse
sink for this card:

Sink #0
        Name: alsa_output.pci-0000_01_00.1.hdmi-stereo
                device.string = "hdmi:1"
Sink #1
... // from another card

If I hack /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf to
change hdmi-stereo's device-strings value to e.g. "hdmi:%f,0", "hdmi:%f,1",
etc., then I can cause pulseaudio to open whichever subdevice I wish. This
proves to me that this is simply an enumeration issue and nothing more
fundamental.

Is this simply something that's not been implemented in the pulseaudio
server, or is there a bug that's preventing the server from exposing a sink
per ALSA device/subdevice?

Looking at the code, I believe this is because pa_alsa_profile_set_probe is
called once per card, and probes ALSA device names of the form "hdmi:%f"
where %f is simply replaced by the card number; there is no attempt to
iterate over N devices within an ALSA card, or even M subdevices within an
ALSA device. Perhaps the whole (or a significant portion) of the body of
pa_alsa_profile_set_probe should be wrapped in:

    for device in all-devices-of(card):
        for subdevice in all-subdevices-of(card, device)
             // existing for all profiles loop here

and device, subdevice also passed into pa_alsa_open_by_template, and
interpolated into the device name string?

-- 
nvpublic




More information about the pulseaudio-discuss mailing list