[alsa-devel] ioplug plugin programming: HW_PERIOD_BYTES and HW_PERIODS constraints ?
dev.c0debabe at gmail.com
Thu Oct 1 14:17:16 CEST 2009
I'm currently developing an ALSA ioplug plugin that should transfer
audio samples to a DSP over UART.
In my plugin code I set up the hardware constrains (HW_PERIOD_BYTES and
HW_PERIODS being among them) and then I utilize the transfer callback to
send the audio chunk over UART.
The DSP application would like to have exactly 156 - 164 audio samples
at a time, where the sampling rate has to be 8 kHz and the format is S16_LE.
In between there has to be a delay of 20ms (which is equal to 164 audio
frames at a sampling rate of 8 kHz (i.e. 164 * 125us = 20,5 ms).
For this reason I configured HW_PERIOD_BYTES with these values.
The result is that each time the transfer callback gets called, exactly
312 bytes (thus 164 frames with each one having 2 bytes) are transfered.
However, what I do not understand is the setup of HW_PERIODS which is
AFAIK the number of periods being transfered at a time ?
* What is the influence of this constraint on my ioplug plugin ?
* How does it change the way data is being transfered with the transfer
* What would be the correct setup for the mentioned application ?
More information about the Alsa-devel