Reputation: 887
I'm new to sound programming and ALSA. I'd like to create a little application, that for example prints out to the console when a frame of data is written to ALSA with snd_pcm_writei(...)
. Is that possible and if so, how?
Currently I'm thinking of registering a callback to ALSA so when an application calls snd_pcm_writei(...)
the callback is executed. But I'm not sure that is how it works.
Upvotes: 0
Views: 411
Reputation: 180020
You can either use
snd_pcm_write*()
returns only when all the data has been written into the ring buffer (or when an error has occured), orSND_PCM_NONBLOCK
when opening, or snd_pcm_nonblock()
), in which you can use poll()
/epoll()
etc. to get a notification.Using an ALSA async handler works only with certain devices, and has all the drawbacks of signal handlers; it is deprecated.
Upvotes: 1