aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--doc/mpd.conf.56
-rw-r--r--doc/mpdconf.example1
-rw-r--r--src/mixer/alsa_mixer.c9
4 files changed, 16 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index ba5e84f8..1ba01763 100644
--- a/NEWS
+++ b/NEWS
@@ -50,6 +50,8 @@ ver 0.15 (200?/??/??)
* mixers:
- rewritten mixer code to support multiple mixers
- new pulseaudio mixer
+ - alsa: new mixer_index option supports choosing between multiple
+ identically-named controls on a device.
* Add audio archive extraction support:
- bzip2
- iso9660
diff --git a/doc/mpd.conf.5 b/doc/mpd.conf.5
index f6ac80f6..f5f4f822 100644
--- a/doc/mpd.conf.5
+++ b/doc/mpd.conf.5
@@ -293,6 +293,12 @@ This specifies which mixer control to use (sometimes referred to as the
"device"). Examples of mixer controls are PCM, Line1, Master, etc. An example
for OSS is "Pcm", and an example for alsa is "PCM".
.TP
+.B mixer_index <mixer index>
+A number identifying the index of the named mixer control. This is
+probably only useful if your alsa device has more than one
+identically\-named mixer control. The default is "0". (Use "amixer
+scontrols" to see the list of controls with their indexes)
+.TP
.B use_mmap <yes or no>
Setting this allows you to use memory-mapped I/O. Certain hardware setups may
benefit from this, but most do not. Most users do not need to set this. The
diff --git a/doc/mpdconf.example b/doc/mpdconf.example
index abaef1c1..91932623 100644
--- a/doc/mpdconf.example
+++ b/doc/mpdconf.example
@@ -181,6 +181,7 @@ input {
# format "44100:16:2" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
+# mixer_index "0" # optional
#}
#
# An example of an OSS output:
diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c
index fb083433..52f30b6f 100644
--- a/src/mixer/alsa_mixer.c
+++ b/src/mixer/alsa_mixer.c
@@ -25,6 +25,7 @@
#define VOLUME_MIXER_ALSA_DEFAULT "default"
#define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM"
+#define VOLUME_MIXER_ALSA_INDEX_DEFAULT 0
struct alsa_mixer {
/** the base mixer class */
@@ -32,6 +33,7 @@ struct alsa_mixer {
const char *device;
const char *control;
+ unsigned int index;
snd_mixer_t *handle;
snd_mixer_elem_t *elem;
@@ -51,6 +53,8 @@ alsa_mixer_init(const struct config_param *param)
VOLUME_MIXER_ALSA_DEFAULT);
am->control = config_get_block_string(param, "mixer_control",
VOLUME_MIXER_ALSA_CONTROL_DEFAULT);
+ am->index = config_get_block_unsigned(param, "mixer_index",
+ VOLUME_MIXER_ALSA_INDEX_DEFAULT);
return &am->base;
}
@@ -117,8 +121,9 @@ alsa_mixer_open(struct mixer *data)
while (elem) {
if (snd_mixer_elem_get_type(elem) == SND_MIXER_ELEM_SIMPLE) {
- if (strcasecmp(am->control,
- snd_mixer_selem_get_name(elem)) == 0) {
+ if ((strcasecmp(am->control,
+ snd_mixer_selem_get_name(elem)) == 0) &&
+ (am->index == snd_mixer_selem_get_index(elem))) {
break;
}
}