All of lore.kernel.org
 help / color / mirror / Atom feed
* How to select between mixer route elements?
@ 2006-05-01 22:06 lamikr
  2006-05-02 12:18 ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: lamikr @ 2006-05-01 22:06 UTC (permalink / raw)
  To: alsa-devel

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

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

end of thread, other threads:[~2006-05-10 11:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-01 22:06 How to select between mixer route elements? lamikr
2006-05-02 12:18 ` Takashi Iwai
2006-05-05 16:04   ` lamikr
2006-05-08 23:55     ` lamikr
2006-05-10 11:14       ` Takashi Iwai

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.