I would like to call snd_pcm_readi() and get AUDIO DATA every 20 ms or every 40 ms. I want to know how to get my data synchronously ... that is every X ms ...
Thanks for any responses.
I would like to call snd_pcm_readi() and get AUDIO DATA every 20 ms or every 40 ms. I want to know how to get my data synchronously ... that is every X ms ...
Thanks for any responses.
for realtime audio read or playback, you'll typically create a dedicated high priority worker thread to call from, and then utilize a few ring buffers. your thread should avoid locking.
alsa examples:
http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2latency_8c-example.html#a36
http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html
if you're simply reading from disk, you'll want ample buffer, then just wake up and see if you need to read more before the next time you wake up (considering total latency).