On Tue, 12 May 2009, Lennart Poettering wrote:
Hmm? The first thing snd_pcm_hw_open() does is calling snd_ctl_hw_open(). So with your code, the name will bre resolved and the ctl device opened and closed for that. And then shortly after the device will be reopened right-away and then kept open. In my code after the resolving I'd just keep the device open.
Your code requires three open()s for this, mine required two.
I see your point now - I forgot that control API is used to prefer subdevices. But it would be better to add some cache for ctl opens in alsa-lib rather than abusing other levels of API with additional information.
Thanks, Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.