[alsa-devel] Switching from default to plughw:0,0

Gonzalo Garramuño ggarra13 at gmail.com
Sun Sep 11 19:40:53 CEST 2016



El 11/09/16 a las 07:58, Clemens Ladisch escribió:
> When PulseAudio is configured as the default, it can be accessed through the ALSA API.
How exactly?
>
> Anyway, the correct name for the default device is "default".
>
> To get a list of devices, see "aplay -L".
Here's the output of aplay -L
$ aplay -L

default
     Playback/recording through the PulseAudio sound server
null
     Discard all samples (playback) or generate zero samples (capture)
pulse
     PulseAudio Sound Server
sysdefault:CARD=PCH
     HDA Intel PCH, ALC1150 Analog
     Default Audio Device
front:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     Front speakers
surround21:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     4.0 Surround output to Front and Rear speakers
surround41:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Digital
     IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     Direct sample mixing device
dmix:CARD=PCH,DEV=1
     HDA Intel PCH, ALC1150 Digital
     Direct sample mixing device
dsnoop:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     Direct sample snooping device
dsnoop:CARD=PCH,DEV=1
     HDA Intel PCH, ALC1150 Digital
     Direct sample snooping device
hw:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     Direct hardware device without any conversions
hw:CARD=PCH,DEV=1
     HDA Intel PCH, ALC1150 Digital
     Direct hardware device without any conversions
plughw:CARD=PCH,DEV=0
     HDA Intel PCH, ALC1150 Analog
     Hardware device with all software conversions
plughw:CARD=PCH,DEV=1
     HDA Intel PCH, ALC1150 Digital
     Hardware device with all software conversions
hdmi:CARD=NVidia,DEV=0
     HDA NVidia, HDMI 0
     HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
     HDA NVidia, HDMI 1
     HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
     HDA NVidia, HDMI 2
     HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
     HDA NVidia, HDMI 3
     HDMI Audio Output
dmix:CARD=NVidia,DEV=3
     HDA NVidia, HDMI 0
     Direct sample mixing device
dmix:CARD=NVidia,DEV=7
     HDA NVidia, HDMI 1
     Direct sample mixing device
dmix:CARD=NVidia,DEV=8
     HDA NVidia, HDMI 2
     Direct sample mixing device
dmix:CARD=NVidia,DEV=9
     HDA NVidia, HDMI 3
     Direct sample mixing device
dsnoop:CARD=NVidia,DEV=3
     HDA NVidia, HDMI 0
     Direct sample snooping device
dsnoop:CARD=NVidia,DEV=7
     HDA NVidia, HDMI 1
     Direct sample snooping device
dsnoop:CARD=NVidia,DEV=8
     HDA NVidia, HDMI 2
     Direct sample snooping device
dsnoop:CARD=NVidia,DEV=9
     HDA NVidia, HDMI 3
     Direct sample snooping device
hw:CARD=NVidia,DEV=3
     HDA NVidia, HDMI 0
     Direct hardware device without any conversions
hw:CARD=NVidia,DEV=7
     HDA NVidia, HDMI 1
     Direct hardware device without any conversions
hw:CARD=NVidia,DEV=8
     HDA NVidia, HDMI 2
     Direct hardware device without any conversions
hw:CARD=NVidia,DEV=9
     HDA NVidia, HDMI 3
     Direct hardware device without any conversions
plughw:CARD=NVidia,DEV=3
     HDA NVidia, HDMI 0
     Hardware device with all software conversions
plughw:CARD=NVidia,DEV=7
     HDA NVidia, HDMI 1
     Hardware device with all software conversions
plughw:CARD=NVidia,DEV=8
     HDA NVidia, HDMI 2
     Hardware device with all software conversions
plughw:CARD=NVidia,DEV=9
     HDA NVidia, HDMI 3
     Hardware device with all software conversions


>
> Regards,
> Clemens
Thanks, Clemens.  My code works with the "default" device.  On the 
gnome-control-center, I am able to switch the default device and all 
works fine.

My problem is when I want my program to specify the device to use 
directly from the GUI: plughw:0,0.  The device is in control of 
pulseaudio and does not release it until about 7 seconds go by with no 
audio.  I tried a similar set up in vlc and the result was the same (vlc 
reported that it could not open the device), so I know it is not my code.

Let me know how can I control pulseaudio to close immediately the 
virtual device it opens.



More information about the Alsa-devel mailing list