[alsa-devel] question for the snd_pcm_mmap_writen.

Clemens Ladisch clemens at ladisch.de
Tue Oct 11 16:23:54 CEST 2011

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]???


> 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.


More information about the Alsa-devel mailing list