|
ALSA plugin programming question
Hello,
I have a question about programming ALSA plugins. Sorry if this has been asked before, but I did a search and did not find what I'm looking for.
I'm trying to write an ALSA plugin that adds audio processing effects to a stream. Basically modifies the incoming PCM stream and pumps out to a slave device that is a real ALSA hardware device. I've chosen to go with the external PCM plugin, since I will not be changing the sampling rate or anything, just modifying the sample data.
Now my questions:
1) I have access to the plugin's own snd_pcm_t data structure, but I can't get to the slave's snd_pcm_t info. I need to do this because I need two pieces of information: sampling rate, and memory map access method (interleaved or not). I won't be changing these, I just need to know what they are so I can set up my algorithm accordingly. Or, is it possible that these are not available due to the constraint of this type of plugin, and that the plugin's own snd_pcm_t settings will be synchronized with that of the slave's? If that's the case I can work with that too since I can just read my own plugin's pcm->access and pcm->rate for the info.
2) The .transfer callback returns the size. What is this for? What if I get a block of 256 samples to transfer, I only process half of them and return 128. Is it going retry again at sample #129?
3) I can't seem to find any resources on ALSA plugin programming. Are there websites, books that you can recommend? I've already looked at also-project.org, not much info there. In fact, that website has basically the same info as the comments in the source code.
Thank you
|