[alsa-devel] Broken playback

Clemens Ladisch cladisch at fastmail.net
Wed Nov 21 17:09:35 CET 2007

Gabriele Melia wrote:
> > Try non-blocking mode (see the snd_pcm_nonblock function). In non-
> > blocking mode, the writei call will only write as much data as can be
> > written without waiting (or returns -EAGAIN if the buffer is already
> > full at the moment).
> I'm already in this case

Then the problem is not that the writei call takes too long.
An underrun can happen only when your code takes too much time between
two consecutive calls to writei.

> How to set the buffer size of the circular buffer in which i store the
> pcm that is then called by alsa?

snd_pcm_hw_params_set_buffer_size_near(), but the allowed values are
hardware dependent.  You might want to add your own circular buffer that
is bigger than ALSA's.


More information about the Alsa-devel mailing list