mirror of https://github.com/ericonr/sndio.git
Unbreak channel duplication (aka -j option).
Fix from Peter Piwowarski <peterjpiwowarski at gmail.com> with few tweaks from me. Thanks.
This commit is contained in:
parent
c38dfbf530
commit
6d02c2e7a2
32
sndiod/dev.c
32
sndiod/dev.c
|
@ -1503,6 +1503,7 @@ dev_mmcloc(struct dev *d, unsigned int origin)
|
|||
void
|
||||
slot_initconv(struct slot *s)
|
||||
{
|
||||
unsigned int dev_nch;
|
||||
struct dev *d = s->dev;
|
||||
|
||||
if (s->mode & MODE_PLAY) {
|
||||
|
@ -1520,17 +1521,23 @@ slot_initconv(struct slot *s)
|
|||
}
|
||||
s->mix.join = 1;
|
||||
s->mix.expand = 1;
|
||||
if (s->opt->dup) {
|
||||
if (s->mix.cmap.nch > s->mix.nch)
|
||||
s->mix.expand = s->mix.cmap.nch / s->mix.nch;
|
||||
else if (s->mix.cmap.nch > 0)
|
||||
s->mix.join = s->mix.nch / s->mix.cmap.nch;
|
||||
if (s->opt->dup && s->mix.cmap.nch > 0) {
|
||||
dev_nch = d->pchan < (s->opt->pmax + 1) ?
|
||||
d->pchan - s->opt->pmin :
|
||||
s->opt->pmax - s->opt->pmin + 1;
|
||||
if (dev_nch > s->mix.nch)
|
||||
s->mix.expand = dev_nch / s->mix.nch;
|
||||
else if (s->mix.nch > dev_nch)
|
||||
s->mix.join = s->mix.nch / dev_nch;
|
||||
}
|
||||
}
|
||||
|
||||
if (s->mode & MODE_RECMASK) {
|
||||
unsigned int outchan = (s->mode & MODE_MON) ?
|
||||
d->pchan : d->rchan;
|
||||
|
||||
cmap_init(&s->sub.cmap,
|
||||
0, ((s->mode & MODE_MON) ? d->pchan : d->rchan) - 1,
|
||||
0, outchan - 1,
|
||||
s->opt->rmin, s->opt->rmax,
|
||||
s->opt->rmin, s->opt->rmin + s->sub.nch - 1,
|
||||
s->opt->rmin, s->opt->rmin + s->sub.nch - 1);
|
||||
|
@ -1543,11 +1550,14 @@ slot_initconv(struct slot *s)
|
|||
}
|
||||
s->sub.join = 1;
|
||||
s->sub.expand = 1;
|
||||
if (s->opt->dup) {
|
||||
if (s->sub.cmap.nch > s->sub.nch)
|
||||
s->sub.join = s->sub.cmap.nch / s->sub.nch;
|
||||
else if (s->sub.cmap.nch > 0)
|
||||
s->sub.expand = s->sub.nch / s->sub.cmap.nch;
|
||||
if (s->opt->dup && s->sub.cmap.nch > 0) {
|
||||
dev_nch = outchan < (s->opt->rmax + 1) ?
|
||||
outchan - s->opt->rmin :
|
||||
s->opt->rmax - s->opt->rmin + 1;
|
||||
if (dev_nch > s->sub.nch)
|
||||
s->sub.join = dev_nch / s->sub.nch;
|
||||
else if (s->sub.nch > dev_nch)
|
||||
s->sub.expand = s->sub.nch / dev_nch;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue