[alsa-devel] parameter for pulse device?

Takashi Iwai tiwai at suse.de
Mon Sep 9 19:52:24 CEST 2019


On Wed, 04 Sep 2019 18:47:06 +0200,
frederik at ofb.net wrote:
> 
> Dear ALSA,
> 
> In my ~/.asoundrc, I have lines like this:
> 
>    pcm.mic { type pulse; device "mic" }
>    pcm.monitor { type pulse; device "monitor"; }
>    pcm.music { type pulse; device "music"; }
> 
> to make it easier for ALSA-aware programs to input and output via PulseAudio, e.g.:
> 
>    ecasound -i alsa,mic -o alsa,monitor -etd:...
> 
> However, I would like to simplify this and not have to update ~/.asoundrc every time I create a new PulseAudio device. Since ALSA has the ability for PCMs to take a parameter, I thought this might work with the "pulse" PCM and the PulseAudio device name. But I get an "error: Invalid argument" when trying to pass the device name as an argument to the "pulse" PCM:
> 
>    $ ecasound -o alsa,pulse:music -i some.wav
>    ...
>    ALSA lib conf.c:5014:(snd_config_expand) Unknown parameters music
>    ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM pulse:music
>    ERROR:  Connecting chainsetup failed: "Enabling chainsetup: AUDIOIO-ALSA:
>    ... Unable to open ALSA-device for playback; error: Invalid argument"
> 
> Is there some magic with macros that I can use to accomplish this syntax, or can we add the ability for the "pulse" PCM to take a parameter naming the device?

It depends on how pcm.pulse is defined.  If it's defined to take an
argument, it can work like that.  (Or sometimes you may need to pass
the argument explicitly like "pulse:{device=mointor}".)

The standard pcm.pulse definition provided in alsa-plugins repo
doesn't take the argument, and that can be the reason.


Takashi


More information about the Alsa-devel mailing list