]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add a "mixer_control_index" setting to the "alsa" part of ther configuration file...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 21 Jan 2022 17:02:11 +0000 (18:02 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 21 Jan 2022 17:02:11 +0000 (18:02 +0100)
audio_alsa.c
scripts/shairport-sync.conf

index b464279c2e1e6fdfd67909c5288b5031d79213a3..afe365d2e9950f8bd5f3198996feb88c0f675cd5 100644 (file)
@@ -298,10 +298,10 @@ int open_mixer() {
             debug(1, "Failed to load mixer element");
             response = -4;
           } else {
-            debug(3, "Mixer Control name is \"%s\".", alsa_mix_ctrl);
+            debug(3, "Mixer control is \"%s\",%d.", alsa_mix_ctrl, alsa_mix_index);
             alsa_mix_elem = snd_mixer_find_selem(alsa_mix_handle, alsa_mix_sid);
             if (!alsa_mix_elem) {
-              warn("failed to find mixer control \"%s\".", alsa_mix_ctrl);
+              warn("failed to find mixer control \"%s\",%d.", alsa_mix_ctrl, alsa_mix_index);
               response = -5;
             } else {
               response = 1; // we found a hardware mixer and successfully opened it
@@ -1054,6 +1054,16 @@ static int init(int argc, char **argv) {
       alsa_mix_ctrl = (char *)str;
     }
 
+
+    // Get the Mixer Control Index
+    if (config_lookup_int(config.cfg, "alsa.mixer_control_index", &value)) {
+      alsa_mix_index = value;
+    }
+
+
+
+
+
     /* Get the disable_synchronization setting. */
     if (config_lookup_string(config.cfg, "alsa.disable_synchronization", &str)) {
       if (strcasecmp(str, "no") == 0)
index e7f9e7480300d2fb05bb8214efee306eda290f94..c07765b232c799d6fb8fa7e54509d0bea9f4f392 100644 (file)
@@ -96,7 +96,8 @@ sessioncontrol =
 alsa =
 {
 //     output_device = "default"; // the name of the alsa output device. Use "shairport-sync -h" to discover the names of ALSA hardware devices. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
-//     mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
+//     mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. No default. If not specified, no mixer is used and volume in adjusted in software.
+//     mixer_control_index = 0; // the index of the mixer to use to adjust output volume. Default is 0. The mixer is fully identified by the combination of the mixer_control_name and the mixer_control_index, e.g. "PCM",0 would be such a specification.
 //     mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
 
 //     output_rate = "auto"; // can be "auto", 44100, 88200, 176400 or 352800, but the device must have the capability.