version 1.99, 2021/03/10 08:22:25 |
version 1.100, 2021/04/28 05:05:05 |
|
|
s->opt->pmin, s->opt->pmin + s->mix.nch - 1, |
s->opt->pmin, s->opt->pmin + s->mix.nch - 1, |
0, d->pchan - 1, |
0, d->pchan - 1, |
s->opt->pmin, s->opt->pmax); |
s->opt->pmin, s->opt->pmax); |
|
s->mix.decbuf = NULL; |
|
s->mix.resampbuf = NULL; |
if (!aparams_native(&s->par)) { |
if (!aparams_native(&s->par)) { |
dec_init(&s->mix.dec, &s->par, s->mix.nch); |
dec_init(&s->mix.dec, &s->par, s->mix.nch); |
|
s->mix.decbuf = |
|
xmalloc(s->round * s->mix.nch * sizeof(adata_t)); |
} |
} |
if (s->rate != d->rate) { |
if (s->rate != d->rate) { |
resamp_init(&s->mix.resamp, s->round, d->round, |
resamp_init(&s->mix.resamp, s->round, d->round, |
s->mix.nch); |
s->mix.nch); |
|
s->mix.resampbuf = |
|
xmalloc(d->round * s->mix.nch * sizeof(adata_t)); |
} |
} |
s->mix.join = 1; |
s->mix.join = 1; |
s->mix.expand = 1; |
s->mix.expand = 1; |
|
|
unsigned int outchan = (s->mode & MODE_MON) ? |
unsigned int outchan = (s->mode & MODE_MON) ? |
d->pchan : d->rchan; |
d->pchan : d->rchan; |
|
|
|
s->sub.encbuf = NULL; |
|
s->sub.resampbuf = NULL; |
cmap_init(&s->sub.cmap, |
cmap_init(&s->sub.cmap, |
0, outchan - 1, |
0, outchan - 1, |
s->opt->rmin, s->opt->rmax, |
s->opt->rmin, s->opt->rmax, |
|
|
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, |
s->sub.nch); |
s->sub.nch); |
|
s->sub.resampbuf = |
|
xmalloc(d->round * s->sub.nch * sizeof(adata_t)); |
} |
} |
if (!aparams_native(&s->par)) { |
if (!aparams_native(&s->par)) { |
enc_init(&s->sub.enc, &s->par, s->sub.nch); |
enc_init(&s->sub.enc, &s->par, s->sub.nch); |
|
s->sub.encbuf = |
|
xmalloc(s->round * s->sub.nch * sizeof(adata_t)); |
} |
} |
s->sub.join = 1; |
s->sub.join = 1; |
s->sub.expand = 1; |
s->sub.expand = 1; |
|
|
void |
void |
slot_allocbufs(struct slot *s) |
slot_allocbufs(struct slot *s) |
{ |
{ |
struct dev *d = s->opt->dev; |
|
|
|
if (s->mode & MODE_PLAY) { |
if (s->mode & MODE_PLAY) { |
s->mix.bpf = s->par.bps * s->mix.nch; |
s->mix.bpf = s->par.bps * s->mix.nch; |
abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf); |
abuf_init(&s->mix.buf, s->appbufsz * s->mix.bpf); |
|
|
s->mix.decbuf = NULL; |
|
s->mix.resampbuf = NULL; |
|
if (!aparams_native(&s->par)) { |
|
s->mix.decbuf = |
|
xmalloc(s->round * s->mix.nch * sizeof(adata_t)); |
|
} |
|
if (s->rate != d->rate) { |
|
s->mix.resampbuf = |
|
xmalloc(d->round * s->mix.nch * sizeof(adata_t)); |
|
} |
|
} |
} |
|
|
if (s->mode & MODE_RECMASK) { |
if (s->mode & MODE_RECMASK) { |
s->sub.bpf = s->par.bps * s->sub.nch; |
s->sub.bpf = s->par.bps * s->sub.nch; |
abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf); |
abuf_init(&s->sub.buf, s->appbufsz * s->sub.bpf); |
|
|
s->sub.encbuf = NULL; |
|
s->sub.resampbuf = NULL; |
|
if (s->rate != d->rate) { |
|
s->sub.resampbuf = |
|
xmalloc(d->round * s->sub.nch * sizeof(adata_t)); |
|
} |
|
if (!aparams_native(&s->par)) { |
|
s->sub.encbuf = |
|
xmalloc(s->round * s->sub.nch * sizeof(adata_t)); |
|
} |
|
} |
} |
|
|
slot_initconv(s); |
|
|
|
#ifdef DEBUG |
#ifdef DEBUG |
if (log_level >= 3) { |
if (log_level >= 3) { |
slot_log(s); |
slot_log(s); |
|
|
{ |
{ |
if (s->mode & MODE_RECMASK) { |
if (s->mode & MODE_RECMASK) { |
abuf_done(&s->sub.buf); |
abuf_done(&s->sub.buf); |
if (s->sub.encbuf) |
|
xfree(s->sub.encbuf); |
|
if (s->sub.resampbuf) |
|
xfree(s->sub.resampbuf); |
|
} |
} |
|
|
if (s->mode & MODE_PLAY) { |
if (s->mode & MODE_PLAY) { |
abuf_done(&s->mix.buf); |
abuf_done(&s->mix.buf); |
if (s->mix.decbuf) |
|
xfree(s->mix.decbuf); |
|
if (s->mix.resampbuf) |
|
xfree(s->mix.resampbuf); |
|
} |
} |
} |
} |
|
|
|
|
long long pos; |
long long pos; |
|
|
/* |
/* |
|
* setup converions layer |
|
*/ |
|
slot_initconv(s); |
|
|
|
/* |
* start the device if not started |
* start the device if not started |
*/ |
*/ |
dev_wakeup(d); |
dev_wakeup(d); |
|
|
#endif |
#endif |
if (s->mode & MODE_PLAY) |
if (s->mode & MODE_PLAY) |
dev_mix_adjvol(d); |
dev_mix_adjvol(d); |
|
|
|
if (s->mode & MODE_RECMASK) { |
|
if (s->sub.encbuf) { |
|
xfree(s->sub.encbuf); |
|
s->sub.encbuf = NULL; |
|
} |
|
if (s->sub.resampbuf) { |
|
xfree(s->sub.resampbuf); |
|
s->sub.resampbuf = NULL; |
|
} |
|
} |
|
|
|
if (s->mode & MODE_PLAY) { |
|
if (s->mix.decbuf) { |
|
xfree(s->mix.decbuf); |
|
s->mix.decbuf = NULL; |
|
} |
|
if (s->mix.resampbuf) { |
|
xfree(s->mix.resampbuf); |
|
s->mix.resampbuf = NULL; |
|
} |
|
} |
} |
} |
|
|
/* |
/* |