diff options
author | Tom Rini <trini@konsulko.com> | 2022-12-06 10:07:01 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-12-06 10:07:01 -0500 |
commit | 14f2d087a3d6347ba0ff7a7e9aaff6955e53e7a8 (patch) | |
tree | bc4677f00c57b7ff42a0852a50d213266896e68a /arch | |
parent | 1c470f32f74248ff4aa145bf033fb6524dc7fc2e (diff) | |
parent | 304bc9f437df51b4d982fe25fd0988350c8f5fc9 (diff) |
Merge tag 'sound-2023-01-rc4' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for sound-2023-01-rc4
* Avoid endless loop and amend unit test
* Add man-page for the sound command
* Fix sandbox sound driver
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sandbox/cpu/sdl.c | 11 | ||||
-rw-r--r-- | arch/sandbox/include/asm/test.h | 10 |
2 files changed, 15 insertions, 6 deletions
diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index f4ca36b35c..2c570ed8d1 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -441,7 +441,6 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) { struct buf_info *buf; int avail; - bool have_data = false; int i; for (i = 0; i < 2; i++) { @@ -453,10 +452,9 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) } if (avail > len) avail = len; - have_data = true; - SDL_MixAudio(stream, buf->data + buf->pos, avail, - SDL_MIX_MAXVOLUME); + memcpy(stream, buf->data + buf->pos, avail); + stream += avail; buf->pos += avail; len -= avail; @@ -466,7 +464,8 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) else break; } - sdl.stopping = !have_data; + memset(stream, 0, len); + sdl.stopping = !!len; } int sandbox_sdl_sound_init(int rate, int channels) @@ -484,7 +483,7 @@ int sandbox_sdl_sound_init(int rate, int channels) wanted.freq = rate; wanted.format = AUDIO_S16; wanted.channels = channels; - wanted.samples = 1024; /* Good low-latency value for callback */ + wanted.samples = 960; /* Good low-latency value for callback */ wanted.callback = sandbox_sdl_fill_audio; wanted.userdata = NULL; diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h index 0406085917..568738c16d 100644 --- a/arch/sandbox/include/asm/test.h +++ b/arch/sandbox/include/asm/test.h @@ -189,6 +189,16 @@ int sandbox_get_setup_called(struct udevice *dev); int sandbox_get_sound_active(struct udevice *dev); /** + * sandbox_get_sound_count() - Read back the count of the sound data so far + * + * This data is provided to the sandbox driver by the sound play() method. + * + * @dev: Device to check + * Return: count of audio data + */ +int sandbox_get_sound_count(struct udevice *dev); + +/** * sandbox_get_sound_sum() - Read back the sum of the sound data so far * * This data is provided to the sandbox driver by the sound play() method. |