On Sun, Apr 15, 2007 at 06:56:56PM -0700, Tim Harvey wrote:
I still don't understand what 'period_size' and a 'period' is?
A period is the interval between updates of the buffer. There must be at least two periods in a buffer to avoid clicks and pops. During playback, call snd_pcm_period_elapsed() each time your device has played a period. ALSA will then update that part of the buffer with new samples. When your device has played the last period in the buffer, it must be set up to start playing from the start of the buffer again.
I've also noticed that I seem to 'have' to call snd_pcm_lib_preallocate_pages_for_all or I get an error when ALSA tries to use the drive. I assume that I need to 'preallocate' or allocate manually upon each 'open' (or another callback?). Is this 'preallocate' going to allocate 1 buffer or 1 buffer per playback/capture?
Please see the document "Writing an ALSA driver".