mirror of https://github.com/ericonr/sndio.git
sndiod: Remove {mix,sub}.slot_cmin, already available un opt struct.
This commit is contained in:
parent
5754ba3986
commit
8be24309cb
28
sndiod/dev.c
28
sndiod/dev.c
|
@ -634,8 +634,8 @@ dev_mix_adjvol(struct dev *d)
|
||||||
for (j = d->slot_list; j != NULL; j = j->next) {
|
for (j = d->slot_list; j != NULL; j = j->next) {
|
||||||
if (!(j->mode & MODE_PLAY))
|
if (!(j->mode & MODE_PLAY))
|
||||||
continue;
|
continue;
|
||||||
if (i->mix.slot_cmin <= j->mix.slot_cmax &&
|
if (i->opt->pmin <= j->mix.slot_cmax &&
|
||||||
i->mix.slot_cmax >= j->mix.slot_cmin)
|
i->mix.slot_cmax >= j->opt->pmin)
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
weight /= n;
|
weight /= n;
|
||||||
|
@ -1422,10 +1422,10 @@ slot_allocbufs(struct slot *s)
|
||||||
|
|
||||||
if (s->mode & MODE_PLAY) {
|
if (s->mode & MODE_PLAY) {
|
||||||
s->mix.bpf = s->par.bps *
|
s->mix.bpf = s->par.bps *
|
||||||
(s->mix.slot_cmax - s->mix.slot_cmin + 1);
|
(s->mix.slot_cmax - s->opt->pmin + 1);
|
||||||
abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf);
|
abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf);
|
||||||
|
|
||||||
slot_nch = s->mix.slot_cmax - s->mix.slot_cmin + 1;
|
slot_nch = s->mix.slot_cmax - s->opt->pmin + 1;
|
||||||
dev_nch = s->opt->pmax - s->opt->pmin + 1;
|
dev_nch = s->opt->pmax - s->opt->pmin + 1;
|
||||||
s->mix.decbuf = NULL;
|
s->mix.decbuf = NULL;
|
||||||
s->mix.resampbuf = NULL;
|
s->mix.resampbuf = NULL;
|
||||||
|
@ -1438,8 +1438,8 @@ slot_allocbufs(struct slot *s)
|
||||||
s->mix.join = slot_nch / dev_nch;
|
s->mix.join = slot_nch / dev_nch;
|
||||||
}
|
}
|
||||||
cmap_init(&s->mix.cmap,
|
cmap_init(&s->mix.cmap,
|
||||||
s->mix.slot_cmin, s->mix.slot_cmax,
|
s->opt->pmin, s->mix.slot_cmax,
|
||||||
s->mix.slot_cmin, s->mix.slot_cmax,
|
s->opt->pmin, s->mix.slot_cmax,
|
||||||
0, d->pchan - 1,
|
0, d->pchan - 1,
|
||||||
s->opt->pmin, s->opt->pmax);
|
s->opt->pmin, s->opt->pmax);
|
||||||
if (!aparams_native(&s->par)) {
|
if (!aparams_native(&s->par)) {
|
||||||
|
@ -1457,10 +1457,10 @@ slot_allocbufs(struct slot *s)
|
||||||
|
|
||||||
if (s->mode & MODE_RECMASK) {
|
if (s->mode & MODE_RECMASK) {
|
||||||
s->sub.bpf = s->par.bps *
|
s->sub.bpf = s->par.bps *
|
||||||
(s->sub.slot_cmax - s->sub.slot_cmin + 1);
|
(s->sub.slot_cmax - s->opt->rmin + 1);
|
||||||
abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf);
|
abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf);
|
||||||
|
|
||||||
slot_nch = s->sub.slot_cmax - s->sub.slot_cmin + 1;
|
slot_nch = s->sub.slot_cmax - s->opt->rmin + 1;
|
||||||
dev_nch = s->opt->rmax - s->opt->rmin + 1;
|
dev_nch = s->opt->rmax - s->opt->rmin + 1;
|
||||||
s->sub.encbuf = NULL;
|
s->sub.encbuf = NULL;
|
||||||
s->sub.resampbuf = NULL;
|
s->sub.resampbuf = NULL;
|
||||||
|
@ -1475,8 +1475,8 @@ slot_allocbufs(struct slot *s)
|
||||||
cmap_init(&s->sub.cmap,
|
cmap_init(&s->sub.cmap,
|
||||||
0, ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1,
|
0, ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1,
|
||||||
s->opt->rmin, s->opt->rmax,
|
s->opt->rmin, s->opt->rmax,
|
||||||
s->sub.slot_cmin, s->sub.slot_cmax,
|
s->opt->rmin, s->sub.slot_cmax,
|
||||||
s->sub.slot_cmin, s->sub.slot_cmax);
|
s->opt->rmin, s->sub.slot_cmax);
|
||||||
if (s->rate != d->rate) {
|
if (s->rate != d->rate) {
|
||||||
resamp_init(&s->sub.resamp, d->round, s->round,
|
resamp_init(&s->sub.resamp, d->round, s->round,
|
||||||
slot_nch);
|
slot_nch);
|
||||||
|
@ -1670,14 +1670,10 @@ found:
|
||||||
s->pstate = SLOT_INIT;
|
s->pstate = SLOT_INIT;
|
||||||
s->mode = mode;
|
s->mode = mode;
|
||||||
aparams_init(&s->par);
|
aparams_init(&s->par);
|
||||||
if (s->mode & MODE_PLAY) {
|
if (s->mode & MODE_PLAY)
|
||||||
s->mix.slot_cmin = s->opt->pmin;
|
|
||||||
s->mix.slot_cmax = s->opt->pmax;
|
s->mix.slot_cmax = s->opt->pmax;
|
||||||
}
|
if (s->mode & MODE_RECMASK)
|
||||||
if (s->mode & MODE_RECMASK) {
|
|
||||||
s->sub.slot_cmin = s->opt->rmin;
|
|
||||||
s->sub.slot_cmax = s->opt->rmax;
|
s->sub.slot_cmax = s->opt->rmax;
|
||||||
}
|
|
||||||
if (s->opt->mmc) {
|
if (s->opt->mmc) {
|
||||||
s->xrun = XRUN_SYNC;
|
s->xrun = XRUN_SYNC;
|
||||||
s->tstate = MMC_STOP;
|
s->tstate = MMC_STOP;
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct slot {
|
||||||
unsigned int vol; /* volume within the vol */
|
unsigned int vol; /* volume within the vol */
|
||||||
struct abuf buf; /* socket side buffer */
|
struct abuf buf; /* socket side buffer */
|
||||||
int bpf; /* byte per frame */
|
int bpf; /* byte per frame */
|
||||||
int slot_cmin, slot_cmax; /* slot source chans */
|
int slot_cmax; /* slot source chans */
|
||||||
struct cmap cmap; /* channel mapper state */
|
struct cmap cmap; /* channel mapper state */
|
||||||
struct resamp resamp; /* resampler state */
|
struct resamp resamp; /* resampler state */
|
||||||
struct conv dec; /* format decoder params */
|
struct conv dec; /* format decoder params */
|
||||||
|
@ -59,7 +59,7 @@ struct slot {
|
||||||
struct abuf buf; /* socket side buffer */
|
struct abuf buf; /* socket side buffer */
|
||||||
int prime; /* initial cycles to skip */
|
int prime; /* initial cycles to skip */
|
||||||
int bpf; /* byte per frame */
|
int bpf; /* byte per frame */
|
||||||
int slot_cmin, slot_cmax; /* slot destination chans */
|
int slot_cmax; /* slot destination chans */
|
||||||
struct cmap cmap; /* channel mapper state */
|
struct cmap cmap; /* channel mapper state */
|
||||||
struct resamp resamp; /* buffer for resampling */
|
struct resamp resamp; /* buffer for resampling */
|
||||||
struct conv enc; /* buffer for encoding */
|
struct conv enc; /* buffer for encoding */
|
||||||
|
|
|
@ -636,7 +636,7 @@ sock_setpar(struct sock *f)
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_putu(s->opt->rmax);
|
log_putu(s->opt->rmax);
|
||||||
log_puts(" -> ");
|
log_puts(" -> ");
|
||||||
log_putu(s->sub.slot_cmin);
|
log_putu(s->opt->rmin);
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_putu(s->sub.slot_cmax);
|
log_putu(s->sub.slot_cmax);
|
||||||
log_puts("\n");
|
log_puts("\n");
|
||||||
|
@ -653,7 +653,7 @@ sock_setpar(struct sock *f)
|
||||||
if (log_level >= 3) {
|
if (log_level >= 3) {
|
||||||
sock_log(f);
|
sock_log(f);
|
||||||
log_puts(": playback channels ");
|
log_puts(": playback channels ");
|
||||||
log_putu(s->mix.slot_cmin);
|
log_putu(s->opt->pmin);
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_putu(s->mix.slot_cmax);
|
log_putu(s->mix.slot_cmax);
|
||||||
log_puts(" -> ");
|
log_puts(" -> ");
|
||||||
|
@ -1011,13 +1011,13 @@ sock_execmsg(struct sock *f)
|
||||||
aparams_log(&s->par);
|
aparams_log(&s->par);
|
||||||
if (s->mode & MODE_PLAY) {
|
if (s->mode & MODE_PLAY) {
|
||||||
log_puts(", play ");
|
log_puts(", play ");
|
||||||
log_puti(s->mix.slot_cmin);
|
log_puti(s->opt->pmin);
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_puti(s->mix.slot_cmax);
|
log_puti(s->mix.slot_cmax);
|
||||||
}
|
}
|
||||||
if (s->mode & MODE_RECMASK) {
|
if (s->mode & MODE_RECMASK) {
|
||||||
log_puts(", rec ");
|
log_puts(", rec ");
|
||||||
log_puti(s->sub.slot_cmin);
|
log_puti(s->opt->rmin);
|
||||||
log_puts(":");
|
log_puts(":");
|
||||||
log_puti(s->sub.slot_cmax);
|
log_puti(s->sub.slot_cmax);
|
||||||
}
|
}
|
||||||
|
@ -1124,11 +1124,11 @@ sock_execmsg(struct sock *f)
|
||||||
m->u.par.msb = s->par.msb;
|
m->u.par.msb = s->par.msb;
|
||||||
if (s->mode & MODE_PLAY) {
|
if (s->mode & MODE_PLAY) {
|
||||||
m->u.par.pchan = htons(s->mix.slot_cmax -
|
m->u.par.pchan = htons(s->mix.slot_cmax -
|
||||||
s->mix.slot_cmin + 1);
|
s->opt->pmin + 1);
|
||||||
}
|
}
|
||||||
if (s->mode & MODE_RECMASK) {
|
if (s->mode & MODE_RECMASK) {
|
||||||
m->u.par.rchan = htons(s->sub.slot_cmax -
|
m->u.par.rchan = htons(s->sub.slot_cmax -
|
||||||
s->sub.slot_cmin + 1);
|
s->opt->rmin + 1);
|
||||||
}
|
}
|
||||||
m->u.par.rate = htonl(s->rate);
|
m->u.par.rate = htonl(s->rate);
|
||||||
m->u.par.appbufsz = htonl(s->appbufsz);
|
m->u.par.appbufsz = htonl(s->appbufsz);
|
||||||
|
|
Loading…
Reference in New Issue