[alsa-devel] Non-blocking snd_pcm_drain?

Clemens Ladisch clemens at ladisch.de
Sat Nov 10 18:28:45 CET 2012


Daniel Sanz wrote:
> I noticed that the snd_pcm_drain call blocks until the buffer is
> completely drained. Is there any way to drain the buffer without
> a block?

Try calling snd_pcm_nonblock(handle, 1).

> I've tried calling snd_pcm_nonblock(handle, 1) before the call to
> snd_pcm_drain but it does not work.

How so?

> The context is that this is an application that plays a particular WAV
> sound repeatedly, so I don't want to wait until the sound is played
> completely before it is played again.

Then why do you drain at all?  Just write the new data into the buffer.


Regards,
Clemens


More information about the Alsa-devel mailing list