[pulseaudio-discuss] Configuring PulseAudio to use ALSA PCM plugin

Ben C bchang_2 at yahoo.com
Fri Mar 4 11:44:48 PST 2011


Thank you for your help Colin,

The reason I'm doing this is I'm researching audio processing effects. So I need 
to intercept the PCM audio stream somewhere along the chain. Currently what we 
have already coded is an ALSA PCM plugin framework, so we would like to use that 
to intercept the PCM audio stream to apply effects as opposed to starting over 
and writing something new.

The parameter we have to adhere to is that the original sound source could come 
from ALSA or PA. We need to satisfy both. So currently we have the generic setup 
where ALSA is defaulted to use the pulse plugin and redirecting everything to 
PA. Then PA would use the ALSA sink "my_sink", and goes back to ALSA, where we 
could insert our PCM plugin. And it turned out due to the hogging of my_sink, 
we'd need to add dmix after.

And I understand PA has additional benefits over dmix, so if there's a better 
way to configure this that's more natural to PA, please let me know.

Thanks!



----- Original Message ----
From: Colin Guthrie <gmane at colin.guthr.ie>
To: pulseaudio-discuss at mail.0pointer.de
Sent: Fri, March 4, 2011 1:00:25 AM
Subject: Re: [pulseaudio-discuss] Configuring PulseAudio to use ALSA PCM plugin

'Twas brillig, and Ben C at 03/03/11 19:39 did gyre and gimble:
>> On Wed, 2011-03-02 at 18:16 -0800, Ben C wrote:
>>> Hello, I'm trying to configure PulseAudio to use an ALSA PCM plugin in the 
>>> audio 
>>>
>>> chain.
>>>
>>> PulseAudio as been configured with:
>>> load-module module-alsa-sink device=my_sink
>>>
>>> And ALSA has been configured with:
>>>
>>> pcm.my_sink {
>>>     type my_pcm_plugin
>>>     slave.pcm "hw:0,0"
>>> }
>>>
>>> However, my_sink seems to get hogged, and be considered "busy". I had to 
>>> configure dmix in order for this setup to work. Is that normal? Am I 
>>> configuring 
>>> something incorrectly? I would assume that to PulseAudio, these ALSA output 
>>> devices are the same, whether it's a physical device or a virtual one. But when 
>>>
>>> using the default configuration (and my_pcm_plugin is not in the chain), dmix 
>
>>> isn't necessary.

FWIW, the fact that my_sink is hogged is perfectly normal.

Unless the h/w itself supports h/w mixing (not many do), then you will
need to use a software mixer. PA is one such software mixer - just route
all your audio through PA and you wont have to worry.

Dmix is the other software mixer. It's rather clever but it is nowhere
near as featureful on it's own as a PA based system.

>>> Thanks for your help.
>>
>> Do you have another line in your default.pa loading
>> module-alsa-card/sink before the line above? module-udev-detect or
>> similar?
> 
> The modules that are loaded before the line are:
> module-device-restore
> module-stream-restore
> module-card-restore
> module-augment-properties
> 
> After the alsa sink, module-udev-detect is loaded. Module-alsa-card isn't 
>loaded 
>
> by the configuration file, but it's there, maybe it's loaded by 
> module-udev-detect.

Yes this is basically what module-udev-detect is designed to do: it
detects all the alsa cards on the system and loads the appropriate
module-alsa-card for them. This includes hotplug events for e.g. USB
devices etc.


I'm not really sure what more to tell you. I'm not sure you discussed
the reasons for setting up PA manually like this, so if you elaborate on
why you think this is a requirement of your setup, we can perhaps give
alternative suggestions for a more natural and simpler setup?



Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss at mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss



      



More information about the pulseaudio-discuss mailing list