[alsa-devel] non-blocking mode example
Clemens Ladisch
clemens at ladisch.de
Sun Aug 13 19:46:22 CEST 2017
ThomasJF wrote:
> I have read a file to buffer with "allframes".
>
> 1.) Do I use snd_pcm_writei(...) with a size of "allframes" or loop it
> with smaller packages (periodsize)
In blocking mode, the call would be able to write all bytes, eventually.
But in non-blocking mode, it is never possible to write more than the
buffer size immediately. So if you try with more frames, the function
will write as much as it can, and you have to retry with the remaining
frames later anyway.
> 2.) What are the actual functions to get the interrupt and send the
> frames needed into the ringbuffer (standard I/O or select)?
The snd_pcm_writei() call sends the frames to the buffer. The
notification that the device is ready (i.e., that there is enough free
space in the buffer to write more samples) comes through any of the
file-handle-waiting functions (select, poll, epoll).
Regards,
Clemens
More information about the Alsa-devel
mailing list