All of lore.kernel.org
 help / color / mirror / Atom feed
* Combined wait for pcm_wait and ctl_wait
@ 2022-06-07  9:56 Pavel Hofman
  2022-06-07 10:15 ` Jaroslav Kysela
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Hofman @ 2022-06-07  9:56 UTC (permalink / raw)
  To: alsa-devel

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Combined wait for pcm_wait and ctl_wait
  2022-06-07  9:56 Combined wait for pcm_wait and ctl_wait Pavel Hofman
@ 2022-06-07 10:15 ` Jaroslav Kysela
  2022-06-08  5:55   ` Pavel Hofman
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2022-06-07 10:15 UTC (permalink / raw)
  To: Pavel Hofman; +Cc: ALSA development

On 07. 06. 22 11:56, Pavel Hofman wrote:
> 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.

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

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Combined wait for pcm_wait and ctl_wait
  2022-06-07 10:15 ` Jaroslav Kysela
@ 2022-06-08  5:55   ` Pavel Hofman
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Hofman @ 2022-06-08  5:55 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: ALSA development


Dne 07. 06. 22 v 12:15 Jaroslav Kysela napsal(a):
> On 07. 06. 22 11:56, Pavel Hofman wrote:
>> 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.
> 
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-08  5:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-07  9:56 Combined wait for pcm_wait and ctl_wait Pavel Hofman
2022-06-07 10:15 ` Jaroslav Kysela
2022-06-08  5:55   ` Pavel Hofman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.