-/* $OpenBSD: dev.c,v 1.98 2021/03/10 08:21:27 ratchov Exp $ */
+/* $OpenBSD: dev.c,v 1.99 2021/03/10 08:22:25 ratchov Exp $ */
/*
* Copyright (c) 2008-2012 Alexandre Ratchov <alex@caoua.org>
*
{
char *p;
char name[SLOT_NAMEMAX];
+ char ctl_name[CTL_NAMEMAX];
unsigned int i, ser, bestser, bestidx;
struct slot *unit[DEV_NSLOT];
struct slot *s;
}
s = slot_array + bestidx;
+ ctl_del(CTL_SLOT_LEVEL, s, NULL);
s->vol = MIDI_MAXCTL;
strlcpy(s->name, name, SLOT_NAMEMAX);
s->serial = slot_serial++;
; /* nothing */
s->unit = i;
s->id = id;
+ s->opt = opt;
+ slot_ctlname(s, ctl_name, CTL_NAMEMAX);
+ ctl_new(CTL_SLOT_LEVEL, s, NULL,
+ CTL_NUM, "app", ctl_name, -1, "level",
+ NULL, -1, 127, s->vol);
found:
if ((mode & MODE_REC) && (opt->mode & MODE_MON)) {
s->appbufsz = s->opt->dev->bufsz;
s->round = s->opt->dev->round;
s->rate = s->opt->dev->rate;
- dev_label(s->opt->dev, s - slot_array);
dev_midi_slotdesc(s->opt->dev, s);
dev_midi_vol(s->opt->dev, s);
#ifdef DEBUG
}
}
-void
-dev_label(struct dev *d, int i)
-{
- struct ctl *c;
- char name[CTL_NAMEMAX];
-
- slot_ctlname(&slot_array[i], name, CTL_NAMEMAX);
-
- c = ctl_list;
- for (;;) {
- if (c == NULL) {
- ctl_new(CTL_SLOT_LEVEL, slot_array + i, NULL,
- CTL_NUM, "app", name, -1, "level",
- NULL, -1, 127, slot_array[i].vol);
- return;
- }
- if (ctl_match(c, CTL_SLOT_LEVEL, slot_array + i, NULL))
- break;
- c = c->next;
- }
- if (strcmp(c->node0.name, name) == 0)
- return;
- strlcpy(c->node0.name, name, CTL_NAMEMAX);
- c->desc_mask = ~0;
-}