mirror of https://github.com/ericonr/sndio.git
sndiod: Hide controls of unused slots
This commit is contained in:
parent
e5f270a89f
commit
3b8a8de5f2
14
sndiod/dev.c
14
sndiod/dev.c
|
@ -1049,7 +1049,7 @@ dev_new(char *path, struct aparams *par,
|
||||||
d->slot[i].ops = NULL;
|
d->slot[i].ops = NULL;
|
||||||
d->slot[i].vol = MIDI_MAXCTL;
|
d->slot[i].vol = MIDI_MAXCTL;
|
||||||
d->slot[i].serial = d->serial++;
|
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++) {
|
for (i = 0; i < DEV_NCTLSLOT; i++) {
|
||||||
d->ctlslot[i].ops = NULL;
|
d->ctlslot[i].ops = NULL;
|
||||||
|
@ -1180,6 +1180,8 @@ dev_open(struct dev *d)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < DEV_NSLOT; i++) {
|
for (i = 0; i < DEV_NSLOT; i++) {
|
||||||
|
if (d->slot[i].name[0] == 0)
|
||||||
|
continue;
|
||||||
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
||||||
dev_addctl(d, "app", CTL_NUM,
|
dev_addctl(d, "app", CTL_NUM,
|
||||||
CTLADDR_SLOT_LEVEL(i),
|
CTLADDR_SLOT_LEVEL(i),
|
||||||
|
@ -2494,15 +2496,21 @@ dev_label(struct dev *d, int i)
|
||||||
struct ctl *c;
|
struct ctl *c;
|
||||||
char name[CTL_NAMEMAX];
|
char name[CTL_NAMEMAX];
|
||||||
|
|
||||||
|
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
||||||
|
|
||||||
c = d->ctl_list;
|
c = d->ctl_list;
|
||||||
for (;;) {
|
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;
|
return;
|
||||||
|
}
|
||||||
if (c->addr == CTLADDR_SLOT_LEVEL(i))
|
if (c->addr == CTLADDR_SLOT_LEVEL(i))
|
||||||
break;
|
break;
|
||||||
c = c->next;
|
c = c->next;
|
||||||
}
|
}
|
||||||
slot_ctlname(&d->slot[i], name, CTL_NAMEMAX);
|
|
||||||
if (strcmp(c->node0.name, name) == 0)
|
if (strcmp(c->node0.name, name) == 0)
|
||||||
return;
|
return;
|
||||||
strlcpy(c->node0.name, name, CTL_NAMEMAX);
|
strlcpy(c->node0.name, name, CTL_NAMEMAX);
|
||||||
|
|
Loading…
Reference in New Issue