[alsa-devel] PCM low level - need help

Takashi Iwai tiwai at suse.de
Mon Apr 2 16:42:03 CEST 2007


At Mon, 2 Apr 2007 14:13:29 +0200,
ODINOT Jean-Marc ETRALI wrote:
> 
> 
> Hi Alsa gurus,
> 
> I've to write an alsa driver for a custom card. I readed
> "writing an alsa driver" and other paper about alsa and drivers. Well I
> got a result, but not as good as I think it's possible with alsa.
> 
> My card have 30 output slots (and 7 input slots), can be 8Khz
> or 16Khz (same rate for every slots), 16bits little endian by sample,
> can have one or more sample for each slot (same for every slots) in a
> frame, an hardware IT every frame (a frame is 30 slots :-).
> The purpose is to get, for each IT, a frame with all the datas.
> IT -> frame
>     [channel1][channel2][channel3]...[channel30]
> channelX
>     [sample1][sample2]...[sampleN]
> sampleX
>     [16bitsle]

And each channel can be opened/closed indepdently?
> 
> At this time, I've something like a frame if I use channel30
> with speaker-test -c30, but if I use channel1, alsa give me a buffer
> with many samples for channel1. And, just after oppening, I get an
> extra word.

I don't understand what you mean here.  Could you elaborate?
Or, even better, attach your driver code and test case...

> BTW I use .copy to get the buffer.
> 
> My questions:
> -why the extra word (can I avoid it?)?
> -how set the buffer len to always have all my channels (used or not)?

If you set the same value (e.g. 30) to both .channels_min and
.channels_max in snd_pcm_hardware definition, apps have to open all
channels.

> -is it possible to have more than a sample by channel contiguous?

I guess you mean a non-interleaved buffer for each channel?

Basically the driver implementation has to follow the hardware
implementation.  If the hardware supports it, it should be possible.
Otherwise it doesn't make sense to implement a wrapper in the driver
side.  If necessary, it can be done in alsa-lib.


Takashi


More information about the Alsa-devel mailing list