diff --git a/sndiod/dev.c b/sndiod/dev.c index 0532dfa..6f8fa83 100644 --- a/sndiod/dev.c +++ b/sndiod/dev.c @@ -634,8 +634,8 @@ dev_mix_adjvol(struct dev *d) for (j = d->slot_list; j != NULL; j = j->next) { if (!(j->mode & MODE_PLAY)) continue; - if (i->mix.slot_cmin <= j->mix.slot_cmax && - i->mix.slot_cmax >= j->mix.slot_cmin) + if (i->opt->pmin <= j->mix.slot_cmax && + i->mix.slot_cmax >= j->opt->pmin) n++; } weight /= n; @@ -1422,10 +1422,10 @@ slot_allocbufs(struct slot *s) if (s->mode & MODE_PLAY) { 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); - 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; s->mix.decbuf = NULL; s->mix.resampbuf = NULL; @@ -1438,8 +1438,8 @@ slot_allocbufs(struct slot *s) s->mix.join = slot_nch / dev_nch; } cmap_init(&s->mix.cmap, - s->mix.slot_cmin, s->mix.slot_cmax, - s->mix.slot_cmin, s->mix.slot_cmax, + s->opt->pmin, s->mix.slot_cmax, + s->opt->pmin, s->mix.slot_cmax, 0, d->pchan - 1, s->opt->pmin, s->opt->pmax); if (!aparams_native(&s->par)) { @@ -1457,10 +1457,10 @@ slot_allocbufs(struct slot *s) if (s->mode & MODE_RECMASK) { 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); - 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; s->sub.encbuf = NULL; s->sub.resampbuf = NULL; @@ -1475,8 +1475,8 @@ slot_allocbufs(struct slot *s) cmap_init(&s->sub.cmap, 0, ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1, s->opt->rmin, s->opt->rmax, - s->sub.slot_cmin, s->sub.slot_cmax, - s->sub.slot_cmin, s->sub.slot_cmax); + s->opt->rmin, s->sub.slot_cmax, + s->opt->rmin, s->sub.slot_cmax); if (s->rate != d->rate) { resamp_init(&s->sub.resamp, d->round, s->round, slot_nch); @@ -1670,14 +1670,10 @@ found: s->pstate = SLOT_INIT; s->mode = mode; aparams_init(&s->par); - if (s->mode & MODE_PLAY) { - s->mix.slot_cmin = s->opt->pmin; + if (s->mode & MODE_PLAY) s->mix.slot_cmax = s->opt->pmax; - } - if (s->mode & MODE_RECMASK) { - s->sub.slot_cmin = s->opt->rmin; + if (s->mode & MODE_RECMASK) s->sub.slot_cmax = s->opt->rmax; - } if (s->opt->mmc) { s->xrun = XRUN_SYNC; s->tstate = MMC_STOP; diff --git a/sndiod/dev.h b/sndiod/dev.h index fd9f23f..361e446 100644 --- a/sndiod/dev.h +++ b/sndiod/dev.h @@ -47,7 +47,7 @@ struct slot { unsigned int vol; /* volume within the vol */ struct abuf buf; /* socket side buffer */ 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 resamp resamp; /* resampler state */ struct conv dec; /* format decoder params */ @@ -59,7 +59,7 @@ struct slot { struct abuf buf; /* socket side buffer */ int prime; /* initial cycles to skip */ 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 resamp resamp; /* buffer for resampling */ struct conv enc; /* buffer for encoding */ diff --git a/sndiod/sock.c b/sndiod/sock.c index 2b6f7de..82f7f64 100644 --- a/sndiod/sock.c +++ b/sndiod/sock.c @@ -636,7 +636,7 @@ sock_setpar(struct sock *f) log_puts(":"); log_putu(s->opt->rmax); log_puts(" -> "); - log_putu(s->sub.slot_cmin); + log_putu(s->opt->rmin); log_puts(":"); log_putu(s->sub.slot_cmax); log_puts("\n"); @@ -653,7 +653,7 @@ sock_setpar(struct sock *f) if (log_level >= 3) { sock_log(f); log_puts(": playback channels "); - log_putu(s->mix.slot_cmin); + log_putu(s->opt->pmin); log_puts(":"); log_putu(s->mix.slot_cmax); log_puts(" -> "); @@ -1011,13 +1011,13 @@ sock_execmsg(struct sock *f) aparams_log(&s->par); if (s->mode & MODE_PLAY) { log_puts(", play "); - log_puti(s->mix.slot_cmin); + log_puti(s->opt->pmin); log_puts(":"); log_puti(s->mix.slot_cmax); } if (s->mode & MODE_RECMASK) { log_puts(", rec "); - log_puti(s->sub.slot_cmin); + log_puti(s->opt->rmin); log_puts(":"); log_puti(s->sub.slot_cmax); } @@ -1124,11 +1124,11 @@ sock_execmsg(struct sock *f) m->u.par.msb = s->par.msb; if (s->mode & MODE_PLAY) { m->u.par.pchan = htons(s->mix.slot_cmax - - s->mix.slot_cmin + 1); + s->opt->pmin + 1); } if (s->mode & MODE_RECMASK) { 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.appbufsz = htonl(s->appbufsz);