[alsa-devel] snd_pcm_hardware_t.info question

Takashi Iwai tiwai at suse.de
Wed Apr 18 15:23:06 CEST 2007

At Tue, 17 Apr 2007 04:36:28 -0700 (PDT),
Ciaccia wrote:
> Hi Takashi,
> Thanks for your explanation. My request was not clear,
> since my understanding of ALSA is lacking and I need
> to understand more...
> The driver I currently have is here:
> http://www.pecore.ch/test/ep93xx-i2s.c.txt
> It's really messy, it performs all the format
> conversions in the driver (they could be done in the
> alsa-lib) and it lacks some functionalities, so I
> would like to make it shorter, better and more
> readable.
> The driver does not currently define
> SNDRV_PCM_INFO_MMAP and the memory is copied in the
> copy callback. I would like to delete the copy
> callback (which is not really used), since the samples
> could be written directly to the dma buffer by
> alsa-lib.
> How does alsa-lib know how to store the samples in the
> dma-buffer?

Based on the information the driver gives: access, formats, channels,

> How does alsa-lib know that the samples
> are interleaved,


> occupy 32 bits each one (even if the
> format is 24 bits) and that the left channel samples
> are at index #0 and the left ones at index #1?

formats has SNDRV_PCM_FMTBIT_S16_{LE|BE}.

>  Or that
> between two consecutive samples in mono there should
> be a 4 bytes gap?

It's possible to support a non-standard stream like that, but it's a
bit complicated.  So, I recommend not to support this first
(i.e. channels_max = channels_min = 2).  Then alsa-lib will copy the
mono stream automatically to stereo.


More information about the Alsa-devel mailing list