From 1b99467c711c8d2d608d193351ea6bf0bef9b500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl=20=C3=85stholm?= Date: Sat, 28 Dec 2024 00:17:02 +0100 Subject: [PATCH] audio: Make SDL_Bind/UnbindAudioStreams take const arrays --- include/SDL3/SDL_audio.h | 4 ++-- src/audio/SDL_audio.c | 4 ++-- src/dynapi/SDL_dynapi_procs.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index d9fa496dfc..9082ac3b8f 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -958,7 +958,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * \sa SDL_UnbindAudioStream * \sa SDL_GetAudioStreamDevice */ -extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams); +extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *streams, int num_streams); /** * Bind a single audio stream to an audio device. @@ -999,7 +999,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SD * * \sa SDL_BindAudioStreams */ -extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams); +extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStreams(SDL_AudioStream * const *streams, int num_streams); /** * Unbind a single audio stream from its audio device. diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e477a749cf..51e1ad2871 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -1858,7 +1858,7 @@ bool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallba return result; } -bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams) +bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream * const *streams, int num_streams) { const bool islogical = !(devid & (1<<1)); SDL_AudioDevice *device = NULL; @@ -1947,7 +1947,7 @@ bool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream) } // !!! FIXME: this and BindAudioStreams are mutex nightmares. :/ -void SDL_UnbindAudioStreams(SDL_AudioStream **streams, int num_streams) +void SDL_UnbindAudioStreams(SDL_AudioStream * const *streams, int num_streams) { /* to prevent deadlock when holding both locks, we _must_ lock the device first, and the stream second, as that is the order the audio thread will do it. But this means we have an unlikely, pathological case where a stream could change its binding between when we lookup its bound device and when we lock everything, diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 01f6a4de1d..7ba7a94c2a 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -67,7 +67,7 @@ SDL_DYNAPI_PROC(SDL_GPUComputePass*,SDL_BeginGPUComputePass,(SDL_GPUCommandBuffe SDL_DYNAPI_PROC(SDL_GPUCopyPass*,SDL_BeginGPUCopyPass,(SDL_GPUCommandBuffer *a),(a),return) SDL_DYNAPI_PROC(SDL_GPURenderPass*,SDL_BeginGPURenderPass,(SDL_GPUCommandBuffer *a, const SDL_GPUColorTargetInfo *b, Uint32 c, const SDL_GPUDepthStencilTargetInfo *d),(a,b,c,d),return) SDL_DYNAPI_PROC(bool,SDL_BindAudioStream,(SDL_AudioDeviceID a, SDL_AudioStream *b),(a,b),return) -SDL_DYNAPI_PROC(bool,SDL_BindAudioStreams,(SDL_AudioDeviceID a, SDL_AudioStream **b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_BindAudioStreams,(SDL_AudioDeviceID a, SDL_AudioStream * const *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_BindGPUComputePipeline,(SDL_GPUComputePass *a, SDL_GPUComputePipeline *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_BindGPUComputeSamplers,(SDL_GPUComputePass *a, Uint32 b, const SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageBuffers,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUBuffer *const *c, Uint32 d),(a,b,c,d),) @@ -972,7 +972,7 @@ SDL_DYNAPI_PROC(bool,SDL_TryLockSpinlock,(SDL_SpinLock *a),(a),return) SDL_DYNAPI_PROC(bool,SDL_TryWaitSemaphore,(SDL_Semaphore *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_UCS4ToUTF8,(Uint32 a, char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_UnbindAudioStream,(SDL_AudioStream *a),(a),) -SDL_DYNAPI_PROC(void,SDL_UnbindAudioStreams,(SDL_AudioStream **a, int b),(a,b),) +SDL_DYNAPI_PROC(void,SDL_UnbindAudioStreams,(SDL_AudioStream * const *a, int b),(a,b),) SDL_DYNAPI_PROC(void,SDL_UnloadObject,(SDL_SharedObject *a),(a),) SDL_DYNAPI_PROC(bool,SDL_UnlockAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),)