summaryrefslogtreecommitdiff
path: root/src/modules/alsa/alsa-mixer.c
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2020-05-04 13:04:28 +0200
committerArun Raghavan <arun@arunraghavan.net>2020-10-13 10:27:59 +0000
commite0ab9fa4a478a79fac5fa25a957daff4947d5133 (patch)
treed3d948eb6276da8904df45a1b53cdffdea2406aa /src/modules/alsa/alsa-mixer.c
parent06990e32ffbbe2f321091fd0924c0ee85cd92739 (diff)
alsa-mixer: support up to 8 channels per mixer element
We have at least one USB hardware which supports the 8 channels in one mixer element: https://github.com/alsa-project/alsa-ucm-conf/pull/25 Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'src/modules/alsa/alsa-mixer.c')
-rw-r--r--src/modules/alsa/alsa-mixer.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c
index aa9a57331..0de19846f 100644
--- a/src/modules/alsa/alsa-mixer.c
+++ b/src/modules/alsa/alsa-mixer.c
@@ -1794,16 +1794,16 @@ static bool element_probe_volume(pa_alsa_element *e, snd_mixer_elem_t *me) {
alsa_id_str(buf, sizeof(buf), &e->alsa_id);
pa_log_warn("Volume element %s with no channels?", buf);
return false;
- } else if (e->n_channels > 2) {
+ } else if (e->n_channels > 8) {
/* FIXME: In some places code like this is used:
*
* e->masks[alsa_channel_ids[p]][e->n_channels-1]
*
* The definition of e->masks is
*
- * pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST + 1][2];
+ * pa_channel_position_mask_t masks[SND_MIXER_SCHN_LAST + 1][8];
*
- * Since the array size is fixed at 2, we obviously
+ * Since the array size is fixed at 8, we obviously
* don't support elements with more than two
* channels... */
alsa_id_str(buf, sizeof(buf), &e->alsa_id);
@@ -2463,7 +2463,7 @@ static pa_channel_position_mask_t parse_mask(const char *m) {
static int element_parse_override_map(pa_config_parser_state *state) {
pa_alsa_path *p;
pa_alsa_element *e;
- const char *split_state = NULL;
+ const char *split_state = NULL, *s;
unsigned i = 0;
char *n;
@@ -2489,12 +2489,18 @@ static int element_parse_override_map(pa_config_parser_state *state) {
}
}
- if (pa_streq(state->lvalue, "override-map.1"))
- e->masks[i++][0] = m;
- else
- e->masks[i++][1] = m;
+ s = strstr(state->lvalue, ".");
+ if (s) {
+ int idx;
+ pa_atoi(s + 1, &idx);
+ if (idx >= 1 && idx <= 8) {
+ e->masks[i++][idx-1] = m;
+ } else {
+ pa_log("[%s:%u] Override map index '%s' invalid in '%s'", state->filename, state->lineno, state->lvalue, state->section);
+ }
+ }
- /* Later on we might add override-map.3 and so on here ... */
+ /* Later on we might add override-map.9 and so on here ... */
pa_xfree(n);
}