[alsa-devel] Non-blocking snd_pcm_drain?

Daniel Sanz daniellsanz2 at gmail.com
Sat Nov 10 18:08:37 CET 2012


Hello, I'm new to the ALSA API and I have a question:

I've developed a small program that plays audio from a buffer using
snd_pcm_writei and snd_pcm_drain but 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? I've tried calling snd_pcm_nonblock(handle, 1)
before the call to snd_pcm_drain but it does not work.

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.

What would be the best way to achieve this?

Thanks,


More information about the Alsa-devel mailing list