Skip to contentSkip to conversation

How to redefine "default" to be equivalent to "sysdefault"?

DISCUSSION Tanu Kaskinen 2 participants 5 messages Jun 13, 2012 – Jun 18, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

I have a file with the following contents:

# This file an alsa configuration file, used by pasuspender to make the # "default" Alsa device work while PulseAudio is in suspended state.

# Include the system configuration first. Is there any easier way to do this? # 14 lines for including one file is a bit much...
@hooks [

        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/alsa.conf"
                                ]
                        }
                ]
        }

]

# Redefine "default" to be the same as "sysdefault". On most systems # "sysdefault" is configured to use dmix.
pcm.!default sysdefault

That doesn't do what I want it to do. When I run

ALSA_CONFIG_PATH=/path/to/file.conf aplay -Ddefault ~/test.wav

aplay still uses pulseaudio. Using "-Dsysdefault" instead of "-Ddefault" doesn't use pulseaudio, so "sysdefault" does what it's supposed to do. The problem is then: why doesn't "default" behave the same way as "sysdefault"?

What error did I make?

Below is "aplay -L" output with and without setting the environment variable. When the environment variable is set, "default" is listed twice, and "null" and "pulse" are included in the list while they are not included in the list when running aplay without the environment variable. What causes those differences?

Quoted 1 line

ALSA_CONFIG_PATH=/path/to/file.conf aplay -L

default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
Playback/recording through the PulseAudio sound server
default
Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
HDA Intel, AD198x Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, AD198x Digital
IEC958 (S/PDIF) Digital Audio Output

Quoted 1 line

aplay -L

default
Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
HDA Intel, AD198x Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, AD198x Digital
IEC958 (S/PDIF) Digital Audio Output

Signature · 1 line
Tanu
#1 lore raw

At Wed, 13 Jun 2012 10:57:34 +0300,

Quoted 33 lines · Tanu Kaskinen

Hi,

I have a file with the following contents:

# This file an alsa configuration file, used by pasuspender to make the # "default" Alsa device work while PulseAudio is in suspended state.

# Include the system configuration first. Is there any easier way to do this? # 14 lines for including one file is a bit much...
@hooks [

        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/alsa.conf"
                                ]
                        }
                ]
        }

]

# Redefine "default" to be the same as "sysdefault". On most systems # "sysdefault" is configured to use dmix.
pcm.!default sysdefault

Quoted 3 lines

That doesn't do what I want it to do. When I run

ALSA_CONFIG_PATH=/path/to/file.conf aplay -Ddefault ~/test.wav

Doesn't ALSA_CONFIG_PATH=/path/to/file.conf:/usr/share/alsa/alsa.conf work? $ALSA_CONFIG_PATH overrides the whole default paths, so it doesn't include even sysdefault definition unless you specify multiple paths.

Takashi

Quoted 88 lines

aplay still uses pulseaudio. Using "-Dsysdefault" instead of "-Ddefault" doesn't use pulseaudio, so "sysdefault" does what it's supposed to do. The problem is then: why doesn't "default" behave the same way as "sysdefault"?

What error did I make?

Below is "aplay -L" output with and without setting the environment variable. When the environment variable is set, "default" is listed twice, and "null" and "pulse" are included in the list while they are not included in the list when running aplay without the environment variable. What causes those differences?

Quoted 1 line

ALSA_CONFIG_PATH=/path/to/file.conf aplay -L

default
Playback/recording through the PulseAudio sound server
null
Discard all samples (playback) or generate zero samples (capture)
pulse
Playback/recording through the PulseAudio sound server
default
Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
HDA Intel, AD198x Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, AD198x Digital
IEC958 (S/PDIF) Digital Audio Output

Quoted 1 line

aplay -L

default
Playback/recording through the PulseAudio sound server
sysdefault:CARD=Intel
HDA Intel, AD198x Analog
Default Audio Device
front:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
Front speakers
surround40:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.0 Surround output to Front and Rear speakers
surround41:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Intel,DEV=0
HDA Intel, AD198x Analog
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Intel,DEV=0
HDA Intel, AD198x Digital
IEC958 (S/PDIF) Digital Audio Output

Signature · 6 lines
Tanu

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#2 lore raw
Quoted 35 lines · Takashi Iwai

At Wed, 13 Jun 2012 10:57:34 +0300,

Quoted 33 lines · Tanu Kaskinen

Hi,

I have a file with the following contents:

# This file an alsa configuration file, used by pasuspender to make the # "default" Alsa device work while PulseAudio is in suspended state.

# Include the system configuration first. Is there any easier way to do this? # 14 lines for including one file is a bit much...
@hooks [

        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/alsa.conf"
                                ]
                        }
                ]
        }

]

# Redefine "default" to be the same as "sysdefault". On most systems # "sysdefault" is configured to use dmix.
pcm.!default sysdefault

Quoted 6 lines
Quoted 3 lines

That doesn't do what I want it to do. When I run

ALSA_CONFIG_PATH=/path/to/file.conf aplay -Ddefault ~/test.wav

Doesn't ALSA_CONFIG_PATH=/path/to/file.conf:/usr/share/alsa/alsa.conf work?

I didn't know that I can give multiple files, so I haven't tried. One minor problem with this approach is that the alsa.conf path would be hardcoded, instead of using $(datadir)/alsa.conf.

Quoted 3 lines

$ALSA_CONFIG_PATH overrides the whole default paths, so it
doesn't include even sysdefault definition unless you specify multiple paths.

Yes, but did you miss the part entirely where I load alsa.conf in the beginning of the custom configuration file? That should work too, right?

I know that alsa.conf is being loaded, because if I comment out the part that loads alsa.conf, I indeed get an error saying that "sysdefault" is not defined.

Signature · 1 line
Tanu
#3 lore raw

At Mon, 18 Jun 2012 17:17:34 +0300,

Quoted 48 lines · Tanu Kaskinen
Quoted 35 lines · Takashi Iwai

At Wed, 13 Jun 2012 10:57:34 +0300,

Quoted 33 lines · Tanu Kaskinen

Hi,

I have a file with the following contents:

# This file an alsa configuration file, used by pasuspender to make the # "default" Alsa device work while PulseAudio is in suspended state.

# Include the system configuration first. Is there any easier way to do this? # 14 lines for including one file is a bit much...
@hooks [

        {
                func load
                files [
                        {
                                @func concat
                                strings [
                                        { @func datadir }
                                        "/alsa.conf"
                                ]
                        }
                ]
        }

]

# Redefine "default" to be the same as "sysdefault". On most systems # "sysdefault" is configured to use dmix.
pcm.!default sysdefault

Quoted 6 lines
Quoted 3 lines

That doesn't do what I want it to do. When I run

ALSA_CONFIG_PATH=/path/to/file.conf aplay -Ddefault ~/test.wav

Doesn't ALSA_CONFIG_PATH=/path/to/file.conf:/usr/share/alsa/alsa.conf work?

I didn't know that I can give multiple files, so I haven't tried. One minor problem with this approach is that the alsa.conf path would be hardcoded, instead of using $(datadir)/alsa.conf.

Quoted 6 lines
Quoted 3 lines

$ALSA_CONFIG_PATH overrides the whole default paths, so it
doesn't include even sysdefault definition unless you specify multiple paths.

Yes, but did you miss the part entirely where I load alsa.conf in the beginning of the custom configuration file? That should work too, right?

Ah, OK, I somehow didn't think of that part. Essentially, the oneliner below replaces the 14 lines :)

<confdir:alsa.conf>
pcm.!default sysdefault

Takashi

#4 lore raw
In reply to Tanu Kaskinen
Quoted 13 lines · Tanu Kaskinen
Quoted 12 lines · Takashi Iwai

At Wed, 13 Jun 2012 10:57:34 +0300,

Quoted 10 lines · Tanu Kaskinen

Hi,

I have a file with the following contents:

# This file an alsa configuration file, used by pasuspender to make the # "default" Alsa device work while PulseAudio is in suspended state.

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines

# Include the system configuration first. Is there any easier way to do this? # 14 lines for including one file is a bit much...
@hooks [

        {
                func load
                files [
                        {
                                @func concat
Quoted 8 lines
Quoted 8 lines
                                strings [
                                        { @func datadir }
                                        "/alsa.conf"
                                ]
                        }
                ]
        }

]

As a sidenote, I've now discovered that the cumbersome hooks block can be replaced simply with

<confdir:alsa.conf>

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

# Redefine "default" to be the same as "sysdefault". On most systems # "sysdefault" is configured to use dmix.
pcm.!default sysdefault

That doesn't do what I want it to do. When I run

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

ALSA_CONFIG_PATH=/path/to/file.conf aplay -Ddefault ~/test.wav

Doesn't ALSA_CONFIG_PATH=/path/to/file.conf:/usr/share/alsa/alsa.conf work?

I didn't know that I can give multiple files, so I haven't tried. One minor problem with this approach is that the alsa.conf path would be hardcoded, instead of using $(datadir)/alsa.conf.

I tried that now, and it doesn't work any better - "default" still goes through pulseaudio.

Signature · 1 line
Tanu