Don't add server.device knob if there's only one audio device

This commit is contained in:
Alexandre Ratchov 2020-07-19 13:13:40 +02:00
parent e79f8b5c2f
commit c888f2750b
1 changed files with 9 additions and 6 deletions

View File

@ -1236,12 +1236,15 @@ dev_open(struct dev *d)
NULL, -1, 127, d->slot[i].vol);
}
for (a = d->alt_list; a != NULL; a = a->next) {
snprintf(name, sizeof(name), "%d", a->idx);
dev_addctl(d, "", CTL_SEL,
CTLADDR_ALT_SEL + a->idx,
"server", -1, "device",
name, -1, 1, a->idx == d->alt_num);
/* if there are multiple alt devs, add server.device knob */
if (d->alt_list->next != NULL) {
for (a = d->alt_list; a != NULL; a = a->next) {
snprintf(name, sizeof(name), "%d", a->idx);
dev_addctl(d, "", CTL_SEL,
CTLADDR_ALT_SEL + a->idx,
"server", -1, "device",
name, -1, 1, a->idx == d->alt_num);
}
}
d->pstate = DEV_INIT;