From: kosmirror <kos...@us...> - 2025-05-30 02:40:19
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 5f6cc322256b3c503b462f0a99b221ee304e5482 (commit) via f1511f8ac9c9a9106aa414afa01d87b75d8d419f (commit) from ca4a4104eaf7c9df5d2551f8ef7748e63a7a87d5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5f6cc322256b3c503b462f0a99b221ee304e5482 Author: DC-SWAT <sw...@21...> Date: Fri May 30 09:24:28 2025 +0700 aica: Fix snd_stream_shutdown(). Also a bit improved init. commit f1511f8ac9c9a9106aa414afa01d87b75d8d419f Author: DC-SWAT <sw...@21...> Date: Fri May 30 08:37:24 2025 +0700 aica: Fixed and improved checks for stream init ----------------------------------------------------------------------- Summary of changes: kernel/arch/dreamcast/sound/snd_stream.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/kernel/arch/dreamcast/sound/snd_stream.c b/kernel/arch/dreamcast/sound/snd_stream.c index 76d9c7c1..4c8799e4 100644 --- a/kernel/arch/dreamcast/sound/snd_stream.c +++ b/kernel/arch/dreamcast/sound/snd_stream.c @@ -4,7 +4,7 @@ Copyright (C) 2000, 2001, 2002, 2003, 2004 Megan Potter Copyright (C) 2002 Florian Schulze Copyright (C) 2020 Lawrence Sebald - Copyright (C) 2023, 2024 Ruslan Rostovtsev + Copyright (C) 2023, 2024, 2025 Ruslan Rostovtsev Copyright (C) 2024 Stefanos Kornilios Mitsis Poiitidis SH-4 support routines for SPU streaming sound driver @@ -110,7 +110,8 @@ static uint32_t *sep_buffer[2] = {NULL, NULL}; static mutex_t stream_mutex = MUTEX_INITIALIZER; -static int max_channels = 2; +static int max_channels = 0; +static size_t max_buffer_size = 0; /* Check an incoming handle */ #define CHECK_HND(x) do { \ @@ -323,12 +324,24 @@ int snd_stream_init(void) { int snd_stream_init_ex(int channels, size_t buffer_size) { - if(sep_buffer[0]) { - dbglog(DBG_ERROR, "snd_stream_init_ex(): already initialized\n"); - return -1; + if(max_channels) { + if(channels > max_channels) { + dbglog(DBG_ERROR, "snd_stream_init_ex(): already initialized" + " with %d channels, but %d requested\n", + max_channels, channels); + return -1; + } + else if(max_buffer_size && buffer_size > max_buffer_size) { + dbglog(DBG_ERROR, "snd_stream_init_ex(): already initialized" + " with %d buffer size, but %d requested\n", + max_buffer_size, buffer_size); + return -1; + } + return 0; } max_channels = channels; + max_buffer_size = buffer_size; if(buffer_size > 0) { /* Create stereo separation buffers. This buffer size for each channel. @@ -468,6 +481,9 @@ void snd_stream_shutdown(void) { sep_buffer[0] = NULL; sep_buffer[1] = NULL; } + + max_channels = 0; + max_buffer_size = 0; } /* Enable / disable stream queueing */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |