Merge branch 'master' into mixer

This commit is contained in:
Alexandre Ratchov 2017-11-07 12:41:34 +01:00
commit 40da2ff2b7
2 changed files with 28 additions and 2 deletions

View File

@ -346,7 +346,20 @@ slot_init(struct slot *s)
enc_init(&s->conv, &s->afile.par, slot_nch);
s->convbuf =
xmalloc(s->round * slot_nch * sizeof(adata_t));
enc_sil_do(&s->conv, s->buf.data, bufsz);
}
/*
* cmap_copy() doesn't write samples in all channels,
* for instance when mono->stereo conversion is
* disabled. So we have to prefill cmap_copy() output
* with silence.
*/
if (s->resampbuf) {
memset(s->resampbuf, 0,
dev_round * slot_nch * sizeof(adata_t));
} else if (s->convbuf) {
memset(s->convbuf, 0,
s->round * slot_nch * sizeof(adata_t));
} else {
memset(s->buf.data, 0,
bufsz * slot_nch * sizeof(adata_t));

View File

@ -1763,7 +1763,20 @@ slot_attach(struct slot *s)
enc_init(&s->sub.enc, &s->par, slot_nch);
s->sub.encbuf =
xmalloc(s->round * slot_nch * sizeof(adata_t));
enc_sil_do(&s->sub.enc, s->sub.buf.data, s->appbufsz);
}
/*
* cmap_copy() doesn't write samples in all channels,
* for instance when mono->stereo conversion is
* disabled. So we have to prefill cmap_copy() output
* with silence.
*/
if (s->sub.resampbuf) {
memset(s->sub.resampbuf, 0,
d->round * slot_nch * sizeof(adata_t));
} else if (s->sub.encbuf) {
memset(s->sub.encbuf, 0,
s->round * slot_nch * sizeof(adata_t));
} else {
memset(s->sub.buf.data, 0,
s->appbufsz * slot_nch * sizeof(adata_t));