sandbox: fix sound driver
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 4 Dec 2022 19:48:57 +0000 (20:48 +0100)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 5 Dec 2022 16:43:23 +0000 (17:43 +0100)
commit304bc9f437df51b4d982fe25fd0988350c8f5fc9
tree4cba5069695bdbb6d3cebc4646ca94b27e9ad649
parent3f01307ced9af0c20b48217c2c58b63f824451c5
sandbox: fix sound driver

In the callback function we have to use memcpy(). Otherwise we add
the new samples on top of what is stored in the stream buffer.

If we don't have enough data, zero out the rest of the stream buffer.

Our sampling frequency is 48000. Let the batch size for the callback
function be 960. If we play a multiple of 20 ms, this will always be
a full batch.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/cpu/sdl.c