[alsa-devel] How can I make sure the period size is a multiple of 16?

Eliot Blennerhassett linux at audioscience.com
Wed Sep 5 02:29:54 CEST 2007


On Wednesday 05 September 2007 10:50:31 Timur Tabi wrote:
> To work around a hardware issue, my ASoC driver requires the period size to
> be a multiple of 16.  What is the best way to ensure that?

Well, I was going to refer you to
 http://www-old.alsa-project.org/~iwai/writing-an-alsa-driver/index.html
but I just get a blank page today.

Set snd_pcm_hardware.period_bytes_min to 16 or is that 16 * samplesize?

You need to add some constraints to your driver, in the open callback.
E.g.
snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 16);

List of hwparams that can be constrained is in asound.h
List of constraint helpers in pcm.h, or grep for snd_pcm_hw_constraint to see 
usage examples.

--
Eliot



More information about the Alsa-devel mailing list