[alsa-devel] PCM Plugin Channel question

Brandon Yates Brandon.Yates at adaptivedigital.com
Wed Jul 2 00:59:55 CEST 2014


Hello, I have developed a pcm ext plugin that applies some processing to the audio stream in the transfer callback.

My plugin works for a mono (1 channel) stream. I'd now like to expand it to support stereo data in the form of 2 channels interleaved.  I can't find much information on how this works.  I have a couple questions that I'd greatly appreciate if anyone could help with.

1) Is there any way in the 'SND_PCM_PLUGIN_DEFINE_FUNC' function that I can determine if the user application has opened the stream with 1 channel vs 2 channel? 

2) I assume in the case of two channels my transfer function would need to: a)deinterleave the data from source so my processing routine can access it in a linear buffer and b) reinterleave the data before I copy it to destination.   Is this correct? Is there more to it or things I am overlooking?

3) For IO-plugin I see there is a `SND_PCM_IOPLUG_HW_ACCESS` value I could use to restrict the stream type to `SND_PCM_ACCESS_RW_INTERLEAVED`.  Does there exist a similar function for External PCM Plugin?

4)Is there some fundamental design idea here I am not grasping?

Thanks much!

Brandon


More information about the Alsa-devel mailing list