From: lamikr <lamikr@cc.jyu.fi>
To: alsa-devel@lists.sourceforge.net
Subject: How to select between mixer route elements?
Date: Tue, 02 May 2006 01:06:00 +0300 [thread overview]
Message-ID: <44568648.9040902@cc.jyu.fi> (raw)
Hi
I am working with the tsc2101 alsa sound driver for the iPAQ h6300 and
userspace phone application called gomunicator for that.
For the tsc2101 mixer I have creted an element "Playback Playback Route"
which is currently initalized to be a enumerated element
in a following way.
static char *texts[PLAYBACK_TARGET_COUNT] = {
"Loudspeaker", "Headphone", "Cellphone"
};
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
The idea is following. If I/user want to play music or record by using
normal speaker and mic I need to select "Loudspeaker"
as a playback target. If I instead want to use headphone for that
purpose I need to select Headphone. And when I want to have a phone call
(this iPAQ module has gsm phone) I route tsc2101 to handle gsm module by
selecting "Cellphone".
The problem is that currently I need to use alsa-mixer before I make the
phone calls which is kind of not very handy.
So to get Tux finally a call home properly I should do something like
this from the userspace:
old_selection = get_current_playback_route_selection(),
select_playback_route("Cellphone");
make_call()
end_call()
select_playback_route(old_selection)
To implement the currently selected route item, I have tried following
static int *old_playback_item;
...
snd_mixer_selem_id_set_name (sid, "Playback");
if (elem_playback) {
printf("Playback found\n");
if (snd_mixer_selem_is_enumerated(elem_playback)) {
printf("Playback is enumerated\n");
//snd_mixer_selem_get_enum_item(handle, 0, old_playback_item);
printf("index fo the selected playback item = %d\n",
*old_playback_item);
}
}
but this fails for me giving a following error to output:
Playback found
Playback is enumerated
gomunicator: simple.c:1969: snd_mixer_selem_get_enum_item: Assertion
`elem->type == SND_MIXER_ELEM_SIMPLE' failed.
Could somebody show how to do that in the alsa-lib? (I have not been
able to find any documentation/examples how to handle alsa route
elements when I tried to search from the net)
Mika
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
next reply other threads:[~2006-05-01 22:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-01 22:06 lamikr [this message]
2006-05-02 12:18 ` How to select between mixer route elements? Takashi Iwai
2006-05-05 16:04 ` lamikr
2006-05-08 23:55 ` lamikr
2006-05-10 11:14 ` 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=44568648.9040902@cc.jyu.fi \
--to=lamikr@cc.jyu.fi \
--cc=alsa-devel@lists.sourceforge.net \
/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