Combined wait for pcm_wait and ctl_wait
Hi,
Please is there any way to wait for nonblocking read/write at min_avail (like snd_pcm_wait) AND nonblocking subscribed ctl event (like snd_ctl_wait) in a single combined wait? The goal is to react as fast as possible to ctls in aloop and audio gadget devices which notify about stream stop and start (at new rate/format/channel count) on the other side.
I guess some wizardry with file descriptors and polling multiple fds could do.
Thanks a lot for any help or hints.
Best regards,
Pavel.
Quoted 10 lines · Pavel Hofman
Hi,
Please is there any way to wait for nonblocking read/write at
min_avail(likesnd_pcm_wait) AND nonblocking subscribed ctl event (likesnd_ctl_wait) in a single combined wait? The goal is to react as fast as possible to ctls in aloop and audio gadget devices which notify about stream stop and start (at new rate/format/channel count) on the other side.I guess some wizardry with file descriptors and polling multiple fds could do.
Yes, use snd_ctl_poll_descriptors* and snd_pcm_poll_descriptors* functions to fetch descriptors and translate poll states returned from poll(). The alsaloop utility from alsa-utils may be used as an example.
Jaroslav
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Dne 07. 06. 22 v 12:15 Jaroslav Kysela napsal(a):
Quoted 9 lines · Pavel Hofman
Quoted 8 lines
Hi,
Please is there any way to wait for nonblocking read/write at
min_avail(likesnd_pcm_wait) AND nonblocking subscribed ctl event (likesnd_ctl_wait) in a single combined wait? The goal is to react as fast as possible to ctls in aloop and audio gadget devices which notify about stream stop and start (at new rate/format/channel count) on the other side.
Quoted 5 lines
Quoted 2 lines
I guess some wizardry with file descriptors and polling multiple fds could do.
Yes, use snd_ctl_poll_descriptors* and snd_pcm_poll_descriptors* functions to fetch descriptors and translate poll states returned from
poll(). The alsaloop utility from alsa-utils may be used as an example.
Thanks a lot, I will do so.
With regards,
Pavel.