]> code.delx.au - pulseaudio/commitdiff
alsa-mixer: Take override-maps into account in subset elimination
authorDavid Henningsson <david.henningsson@canonical.com>
Thu, 2 Feb 2012 11:46:54 +0000 (12:46 +0100)
committerColin Guthrie <colin@mageia.org>
Thu, 2 Feb 2012 12:41:51 +0000 (12:41 +0000)
The practical problem is that some users were left with only one
"LFE on Mono" port, as analog-output was considered a subset of
analog-output-lfe-on-mono. Which was not what they wanted.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=40910
BugLink: https://bugs.launchpad.net/bugs/922656
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
src/modules/alsa/alsa-mixer.c

index 2aa708dc632fbae7ed96ac4d5bede0247878cd86..9bf80695735d468af1b7e42a4680b3459127fd2d 100644 (file)
@@ -3014,6 +3014,19 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m
             if (a_limit > b->volume_limit)
                 return FALSE;
         }
+
+        if (a->volume_use == PA_ALSA_VOLUME_MERGE) {
+            int s;
+            /* If override-maps are different, they're not subsets */
+            if (a->n_channels != b->n_channels)
+                return FALSE;
+            for (s = 0; s < SND_MIXER_SCHN_LAST; s++)
+                if (a->masks[s][a->n_channels-1] != b->masks[s][b->n_channels-1]) {
+                    pa_log_debug("Element %s is not a subset - mask a: 0x%lx, mask b: 0x%lx, at channel %d",
+                        a->alsa_name, a->masks[s][a->n_channels-1], b->masks[s][b->n_channels-1], s);
+                    return FALSE;
+               }
+        }
     }
 
     if (a->switch_use != PA_ALSA_SWITCH_IGNORE) {