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