Download raw body.
sndiod: unsigned sample 0 is not silent
On Sat, 14 Dec 2024 14:39:43 +0100 Alexandre Ratchov <alex@caoua.org> wrote: > thank you for the fix and the test case. To make it work for any > unsigned encoding we could use enc_sil_do() instead of memset(). This works for me; enc_sil_do would write the silent frames in the correct encoding. ok gkoehler@ When I find time, I should take another look at ports/emulators/minivmac/files/SGLUSNIO.h where I called sio_flush. Maybe it should be sio_close. minivmac plays u8 and I might have called sio_flush to discard the 0s from this memset. --gkoehler > diff --git a/sndiod/sock.c b/sndiod/sock.c > index af0cb72..443052d 100644 > --- a/sndiod/sock.c > +++ b/sndiod/sock.c > @@ -986,6 +986,7 @@ sock_execmsg(struct sock *f) > struct ctl *c; > struct slot *s = f->slot; > struct amsg *m = &f->rmsg; > + struct conv conv; > unsigned char *data; > unsigned int size, ctl; > int cmd; > @@ -1182,7 +1183,8 @@ sock_execmsg(struct sock *f) > panic(); > } > #endif > - memset(data, 0, f->ralign); > + enc_init(&conv, &s->par, s->mix.nch); > + enc_sil_do(&conv, data, f->ralign / s->mix.bpf); > abuf_wcommit(&s->mix.buf, f->ralign); > f->ralign = s->round * s->mix.bpf; > }
sndiod: unsigned sample 0 is not silent