diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2020-04-16 12:23:54 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2020-04-16 12:23:54 +0000 |
commit | 61faaf9fed51177f6585e5cbef1f87cf2400877a (patch) | |
tree | 4ba1333ce24e68e51f8d4be2dea2654ea016025c /usr.bin/sndiod/dev.c | |
parent | 4c38422d1f3e079169e7406416364d8a57a494ef (diff) |
Hide controls of unused slots from "mixer" clients.
Diffstat (limited to 'usr.bin/sndiod/dev.c')
-rw-r--r-- | usr.bin/sndiod/dev.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/sndiod/dev.c b/usr.bin/sndiod/dev.c index 0f97a3ddcfb..db37a4ab051 100644 --- a/usr.bin/sndiod/dev.c +++ b/usr.bin/sndiod/dev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dev.c,v 1.68 2020/04/15 14:22:29 ratchov Exp $ */ +/* $OpenBSD: dev.c,v 1.69 2020/04/16 12:23:53 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org> * @@ -1012,7 +1012,7 @@ dev_new(char *path, struct aparams *par, d->slot[i].ops = NULL; d->slot[i].vol = MIDI_MAXCTL; d->slot[i].serial = d->serial++; - strlcpy(d->slot[i].name, "prog", SLOT_NAMEMAX); + memset(d->slot[i].name, 0, SLOT_NAMEMAX); } for (i = 0; i < DEV_NCTLSLOT; i++) { d->ctlslot[i].ops = NULL; @@ -1142,6 +1142,8 @@ dev_open(struct dev *d) return 0; for (i = 0; i < DEV_NSLOT; i++) { + if (d->slot[i].name[0] == 0) + continue; slot_ctlname(&d->slot[i], name, CTL_NAMEMAX); dev_addctl(d, "app", CTL_NUM, CTLADDR_SLOT_LEVEL(i), @@ -2433,15 +2435,21 @@ dev_label(struct dev *d, int i) struct ctl *c; char name[CTL_NAMEMAX]; + slot_ctlname(&d->slot[i], name, CTL_NAMEMAX); + c = d->ctl_list; for (;;) { - if (c == NULL) + if (c == NULL) { + dev_addctl(d, "app", CTL_NUM, + CTLADDR_SLOT_LEVEL(i), + name, -1, "level", + NULL, -1, 127, d->slot[i].vol); return; + } if (c->addr == CTLADDR_SLOT_LEVEL(i)) break; c = c->next; } - slot_ctlname(&d->slot[i], name, CTL_NAMEMAX); if (strcmp(c->node0.name, name) == 0) return; strlcpy(c->node0.name, name, CTL_NAMEMAX); |