Re: [linux-audio-dev] select() ?? before snd_pcm_writei(handle, buffer, frames);

From: Clemens Ladisch <clemens@email-addr-hidden>
Date: Mon Mar 27 2006 - 12:38:06 EEST

kurmisk wrote:
> I have write my small _alsa_test_program_.
> [C code ckunkz see below]
> It works good but now i wanna before call
> rc = snd_pcm_writei(handle, buffer, frames);
> somehow check - is sound device free for this call or not.

You could call snd_pcm_avail_update().

If you don't want the write function to block, you can set the device to
non-blocking mode, then snd_pcm_writei() will only write as much data as
can be written without waiting, or will return -EAGAIN if there isn't
free space at all.

You can use snd_pcm_poll_descriptors() to get file handle(s) for polling
(poll() is preferred over select()).

HTH
Clemens
Received on Mon Mar 27 16:15:02 2006

This archive was generated by hypermail 2.1.8 : Mon Mar 27 2006 - 16:15:02 EEST