[alsa-devel] non-blocking mode example

ThomasJF tsepp2001 at t-online.de
Mon Aug 14 19:55:46 CEST 2017


Thanks again Clemens,

I did it with success (moving the pointer with arithmetic forward after 
each periodsize in the big buffer). Now I have a do-while loop with 
select. Now a (I hope ...) last question:

To get the tcp-commands for stop/pause:

1.) Do I have to adapt the tcp-commands inside this loop or...

2.) Do I have to work with any poll descriptors (which?)

Best regards
Thomas


Am 13.08.2017 um 19:46 schrieb Clemens Ladisch:
> 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
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>



More information about the Alsa-devel mailing list