[alsa-devel] question for the snd_pcm_mmap_writen.
Hi
First post to the mail list. I have been reading through the Alsa API and tutorials and it all seems fairly simple. But I still have some questions for the sample format possible to send using the mmap method.
First a short description of my problem. I have a embedded device with a 8 channel audio chip. I only have to use 5 of these channels My goal is not to use any cpu cycles on the 3 unused channels
I have decided to use the non-interleaved method (application specific, streams comes from different sources in a correct hardware specific format).
For this, the function snd_pcm_mmap_writen could be used. When sending data to the device the format should/could be done using a 5 seperate buffers.
snd_pcm_sframes_t snd_pcm_mmap_writen (snd_pcm_t * pcm, void ** bufs, snd_pcm_uframes_t size)
where *bufs[0] equal to first channel *bufs[1] equals to next etc. Q1) Should/must the **bufs be continuations -> bufs[0][size]==bufs[1][0]???
Q2) Is is possible the set bufs[2] == NULL, to signal that the channel is unused?
I think I know the answers. Yes, it should be continues, No data can be set to NULL.
Q3) I have tried to find some information about the SND_PCM_ACCESS_MMAP_COMPLEX. What is this??? My best gees is that it is some entirely hardware specific access format?
Regards Anders Gnistrup
On 10/11/2011 02:06 PM, Anders Gnistrup wrote:
I have a embedded device with a 8 channel audio chip. I only have to use 5 of these channels My goal is not to use any cpu cycles on the 3 unused channels
I have decided to use the non-interleaved method
This helps only if your device actually supports non-interleaved data. Otherwise, the samples of all eight channels will have to be converted.
For this, the function snd_pcm_mmap_writen could be used.
Please note that using mmap makes sense only if you write the data directly into the device's buffer. If you only use snd_pcm_mmap_write*, you could just as well use snd_pcm_write* without mmap.
Q1) Should/must the **bufs be continuations -> bufs[0][size]==bufs[1][0]???
No.
Q2) Is is possible the set bufs[2] == NULL, to signal that the channel is unused?
No, all channels must have data.
Q3) I have tried to find some information about the SND_PCM_ACCESS_MMAP_COMPLEX. What is this???
Typically, it's used for devices that are constructed by mergng multiple interleaved streams. Each channel is described by the address of its first sample and the distance between two consecutive samples.
Regards, Clemens
participants (2)
-
Anders Gnistrup
-
Clemens Ladisch