mirror of https://github.com/ericonr/sndio.git
make the label use chan1 as parameter
This commit is contained in:
parent
13a3a75dc7
commit
b3a8f99047
|
@ -146,18 +146,6 @@ The
|
|||
attribute indicates what the structure describes.
|
||||
Possible types are:
|
||||
.Bl -tag -width "SIOMIX_LABEL"
|
||||
.It SIOMIX_LABEL
|
||||
A label attached to the channel.
|
||||
In mixers exposed by
|
||||
.Xr sndiod 1 ,
|
||||
they correspond to program names.
|
||||
The label string in stored in the
|
||||
.Va grp
|
||||
attribute and is not unique.
|
||||
Labels may dynamically change, but their
|
||||
.Va addr
|
||||
attribute remains the same and can be used to figure out which
|
||||
label is changing.
|
||||
.It SIOMIX_NUM
|
||||
A continuous control in the 0..SIOMIX_INTMAX range.
|
||||
For instance the volume of the speaker.
|
||||
|
@ -172,6 +160,18 @@ from the line input to the speaker.
|
|||
An element of an array of on/off switches.
|
||||
For instance the line-in position of the
|
||||
speaker source selector.
|
||||
.It SIOMIX_LABEL
|
||||
A label attached to the channel.
|
||||
In mixers exposed by
|
||||
.Xr sndiod 1 ,
|
||||
they correspond to program names.
|
||||
The label string in stored in the
|
||||
.Va chan1
|
||||
attribute and is not unique.
|
||||
Labels may dynamically change, but their
|
||||
.Va addr
|
||||
attribute remains the same and can be used to figure out which
|
||||
label is changing.
|
||||
.El
|
||||
.Pp
|
||||
The
|
||||
|
|
35
sndiod/dev.c
35
sndiod/dev.c
|
@ -1152,7 +1152,7 @@ dev_open(struct dev *d)
|
|||
c->curval = d->slot[i].vol;
|
||||
dev_addctl(d, CTL_LABEL,
|
||||
d->ctl_addr + CTLADDR_SLOT_LABEL(i),
|
||||
ctlname, "", d->slot[i].name, NULL, NULL);
|
||||
ctlname, "", "name", d->slot[i].name, "");
|
||||
}
|
||||
dev_uniqname(d, "sndiod", ctlname);
|
||||
c = dev_addctl(d, CTL_NUM,
|
||||
|
@ -2042,20 +2042,21 @@ ctl_log(struct ctl *c)
|
|||
{
|
||||
ctl_chan_log(&c->chan0);
|
||||
log_puts(".");
|
||||
log_puts(c->grp[0] != 0 ? c->grp : "(empty)");
|
||||
if (c->type != CTL_LABEL) {
|
||||
log_puts("=");
|
||||
switch (c->type) {
|
||||
case CTL_NUM:
|
||||
case CTL_SW:
|
||||
log_putu(c->curval);
|
||||
break;
|
||||
case CTL_VEC:
|
||||
case CTL_LIST:
|
||||
ctl_chan_log(&c->chan1);
|
||||
log_puts(":");
|
||||
log_putu(c->curval);
|
||||
}
|
||||
log_puts(c->grp);
|
||||
log_puts("=");
|
||||
switch (c->type) {
|
||||
case CTL_NUM:
|
||||
case CTL_SW:
|
||||
log_putu(c->curval);
|
||||
break;
|
||||
case CTL_VEC:
|
||||
case CTL_LIST:
|
||||
ctl_chan_log(&c->chan1);
|
||||
log_puts(":");
|
||||
log_putu(c->curval);
|
||||
break;
|
||||
case CTL_LABEL:
|
||||
ctl_chan_log(&c->chan1);
|
||||
}
|
||||
log_puts(" at ");
|
||||
log_putu(c->addr);
|
||||
|
@ -2196,9 +2197,9 @@ dev_label(struct dev *d, int i)
|
|||
break;
|
||||
c = c->next;
|
||||
}
|
||||
if (strcmp(c->grp, d->slot[i].name) == 0)
|
||||
if (strcmp(c->chan1.str, d->slot[i].name) == 0)
|
||||
return;
|
||||
strlcpy(c->grp, d->slot[i].name, CTL_NAMEMAX);
|
||||
strlcpy(c->chan1.str, d->slot[i].name, CTL_NAMEMAX);
|
||||
c->desc_mask = ~0;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,9 +64,9 @@ dev_siomix_ondesc(void *arg, struct siomix_desc *desc, int val)
|
|||
continue;
|
||||
ctl_log(c);
|
||||
log_puts(": label -> ");
|
||||
log_puts(desc->grp);
|
||||
log_puts(desc->chan0.str);
|
||||
log_puts("\n");
|
||||
strlcpy(c->grp, desc->grp, CTL_NAMEMAX);
|
||||
strlcpy(c->chan0.str, desc->chan0.str, CTL_NAMEMAX);
|
||||
c->desc_mask = ~0;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue