Loopback device respond to changing parameters on the other end.

Pavel Hofman pavel.hofman at ivitera.com
Mon Oct 5 09:12:45 CEST 2020



Dne 05. 10. 20 v 4:38 alsa at scripple.org napsal(a):
> Hello,
> 
> Let me open by saying I am not an experienced ALSA developer so 
> hopefully I'm just missing something really easy here.
> 
> I'm trying to use some DSP programs that insert themselves into the 
> audio chain via the ALSA loopback device.  My understanding is that 
> whichever program opens the loopback device first sets the parameters, 
> so the DSP
> program has to know what parameters any playback program is going to use 
> before it opens its end of the loopback device.  And it has to know when 
> to release the loopback device so that another (or the same) playback 
> program can open the loopback device with possibly different parameters. 
>   (The DSP program also needs to the know the audio parameters just to 
> do the right thing of course.)
> 
> I'm not sure how best to accomplish this.  I don't want any form of 
> auto-format conversion such as using a resampling or format conversion 
> plugin.  I want the DSP program to access the raw PCM stream however it 
> was configured by the playback program.
> 
> I was thinking I could use the PCM hook system to accomplish what I 
> want.  Capture the SND_PCM_HOOK_TYPE_CLOSE (and possibly even use the
> hook init) to tell the DSP program to close its end of the loopback 
> device.  Capture the SND_PCM_HOOK_TYPE_HW_PARAMS to configure the DSP
> program with the appropriate parameters and tell it to open the loopback 
> device with those new parameters.
> 

There used to be a notification module parameter (pcm_notify) which 
closed the other loopback side if params changed 
https://mailman.alsa-project.org/pipermail/alsa-devel/2020-March/165454.html

I am afraid it remains to be fixed.

Best regards,

Pavel.


More information about the Alsa-devel mailing list