Search code examples
calsaepolllibalsa

Is there any way to wait for alsa events through epoll mechanism?


I fetch alsa device fd by fd field of struct pollfd structure filled by snd_pcm_poll_descriptors... But when it comes to "demangle" event comming from epoll_wait, snd_pcm_poll_descriptors_revents which is no help since only struct pollfd fits to it's arguments.


Solution

  • When you get an epoll notification about a file descriptor, set the corresponding bit(s) in the revents field of the original struct pollfd. Then you can call snd_pcm_poll_descriptors().