From: Nicholas Smethurst <nick.smethurst@gmail.com>
To: alsa-devel@alsa-project.org
Subject: Getting a full device list (was: alsa-lib functions reporting conflicting information with two sound cards)
Date: Fri, 11 May 2007 12:28:43 +0200 [thread overview]
Message-ID: <4644455B.4080706@gmail.com> (raw)
In-Reply-To: <75b66ecd0704191145u3414a5e6id9e3f10ef9c6b854@mail.gmail.com>
Takashi wrote:
> At Thu, 19 Apr 2007 20:08:21 +0200,
> Nicholas Smethurst wrote:
>> However, I note that snd_device_name_hint() does not return hw, plughw,
>> plug, dmix, etc. Are these obtained elsewhere? I would like to build a
>> complete list of all available devices in order to allow the user to
>> select them from a dropdown list in a GUI.
>
> They are not shown unless you give the device description explicitly
> or set a global flag. See the description of snd_device_name_hint()
> function.
Well I tried to understand how to do the two things you mention, but am
still stuck..
In namehint.c, I note that the snd_device_name_hint() function has the
following code:
if (strcmp(iface, "card") == 0)
list.iface = SND_CTL_ELEM_IFACE_CARD;
else if (strcmp(iface, "pcm") == 0)
list.iface = SND_CTL_ELEM_IFACE_PCM;
else if (strcmp(iface, "rawmidi") == 0)
list.iface = SND_CTL_ELEM_IFACE_RAWMIDI;
else if (strcmp(iface, "timer") == 0)
list.iface = SND_CTL_ELEM_IFACE_TIMER;
else if (strcmp(iface, "seq") == 0)
list.iface = SND_CTL_ELEM_IFACE_SEQUENCER;
else if (strcmp(iface, "hwdep") == 0)
list.iface = SND_CTL_ELEM_IFACE_HWDEP;
else
return -EINVAL;
which thus gives possible interface strings of "card", "pcm", "rawmidi",
"timer", "seq", and "hwdep". I concluded from this that the only way to
get the default devices is to set the global variable.
I thus tried doing the following in a small test app:
snd_config_t * conf;
int show_all;
snd_config_update();
if (snd_config_search(snd_config, "defaults.namehint.showall",
&conf) >= 0) {
show_all = snd_config_get_bool(conf);
if (show_all < 1) {
snd_config_set_integer(conf, 1);
}
} else { // Create node.
...
}
but this doesn't work.. I am apparently doing something wrong since the
global configuration is not changed with my code.
Is it possible to change global variables from a user application? Or is
it currently necessary to manually edit the alsa.conf file (as root) in
order to modify "defaults.namehint.showall" to allow applications to see
all devices?
I wish to obtain a full list of available devices in a user application
without running as root and without insisting that the user manually
edits configuration files that he doesn't understand.
Is this possible? If not, can we work towards implementing such
functionality?
Nicholas
next prev parent reply other threads:[~2007-05-11 10:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-19 14:30 alsa-lib functions reporting conflicting information with two sound cards nick smethurst
2007-04-19 15:46 ` Lee Revell
2007-04-19 18:08 ` Nicholas Smethurst
2007-04-19 18:45 ` Lee Revell
2007-05-11 10:28 ` Nicholas Smethurst [this message]
2007-05-11 10:35 ` Getting a full device list (was: alsa-lib functions reporting conflicting information with two sound cards) Jaroslav Kysela
2007-05-11 11:05 ` Getting a full device list Nicholas Smethurst
2007-05-11 11:46 ` Jaroslav Kysela
2007-05-11 15:13 ` Takashi Iwai
2007-05-11 17:01 ` Nicholas Smethurst
2007-05-14 8:36 ` Nicholas Smethurst
2007-05-14 9:18 ` Takashi Iwai
2007-05-14 9:27 ` Nicholas Smethurst
2007-05-14 9:57 ` Takashi Iwai
2007-05-14 10:38 ` Nicholas Smethurst
2007-05-14 12:55 ` Takashi Iwai
2007-04-20 10:13 ` alsa-lib functions reporting conflicting information with two sound cards Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4644455B.4080706@gmail.com \
--to=nick.smethurst@gmail.com \
--cc=alsa-devel@alsa-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).