Index: DOCS/man/en/mplayer.1 =================================================================== RCS file: /cvsroot/mplayer/main/DOCS/man/en/mplayer.1,v retrieving revision 1.717 diff -u -r1.717 mplayer.1 --- DOCS/man/en/mplayer.1 12 Sep 2004 22:43:17 -0000 1.717 +++ DOCS/man/en/mplayer.1 14 Sep 2004 14:04:08 -0000 @@ -1665,7 +1665,7 @@ For ALSA this is the mixer name. . .TP -.B \-mixer-channel (\-ao oss and \-ao alsa only) +.B \-mixer-channel [,mixer index] (\-ao oss and \-ao alsa only) This option will tell MPlayer to use a different channel for controlling volume than the default PCM. Options for OSS include @@ -1674,6 +1674,11 @@ /usr/\:include/\:linux/\:soundcard.h. For ALSA you can use the names e.g.\& alsamixer displays, like .B Master, Line, PCM. +.br +.I NOTE: +ALSA mixer channel names followed by a number must be specified in the +format, i.e. a channel labled 'PCM 1' in alsamixer must be converted to +.B PCM,1. . .TP .B \-nowaveheader (\-ao pcm only) Index: libao2/ao_alsa.c =================================================================== RCS file: /cvsroot/mplayer/main/libao2/ao_alsa.c,v retrieving revision 1.7 diff -u -r1.7 ao_alsa.c --- libao2/ao_alsa.c 30 Jul 2004 16:15:05 -0000 1.7 +++ libao2/ao_alsa.c 14 Sep 2004 14:04:16 -0000 @@ -101,12 +101,30 @@ static char *mix_name = "PCM"; static char *card = "default"; + static char *parsed_mixer_channel; + static int mix_index; long pmin, pmax; long get_vol, set_vol; float f_multi; - if(mixer_channel) mix_name = mixer_channel; + if(mixer_channel){ + char *test_mix_index; + + parsed_mixer_channel = strdup(mixer_channel); + mix_name = strcpy(parsed_mixer_channel, mixer_channel); + + if (test_mix_index = strchr(mix_name, ',')){ + *test_mix_index = 0; + test_mix_index++ ; + mix_index = strtol(test_mix_index, &test_mix_index, 0); + + if (*test_mix_index){ + mp_msg(MSGT_AO,MSGL_ERR,"alsa-control: invalid mixer index. Defaulting to 0\n"); + mix_index = 0 ; + } + } + } if(mixer_device) card = mixer_device; if(ao_data.format == AFMT_AC3) @@ -114,11 +132,13 @@ //allocate simple id snd_mixer_selem_id_alloca(&sid); - + //sets simple-mixer index and name - snd_mixer_selem_id_set_index(sid, 0); + snd_mixer_selem_id_set_index(sid, mix_index); snd_mixer_selem_id_set_name(sid, mix_name); + if (mixer_channel) free(parsed_mixer_channel); + if ((err = snd_mixer_open(&handle, 0)) < 0) { mp_msg(MSGT_AO,MSGL_ERR,"alsa-control: mixer open error: %s\n", snd_strerror(err)); return CONTROL_ERROR;