From 52fefcef2bf4166148d5e45697dc5e8d427578da Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 25 Mar 2025 11:02:57 +0100 Subject: [PATCH] better logging / documentation --- src/window/audio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/window/audio.c b/src/window/audio.c index 413767a..ce6c647 100644 --- a/src/window/audio.c +++ b/src/window/audio.c @@ -61,6 +61,8 @@ static void audiomixer(void* const userdata, uint8_t* const stream, int32_t cons } } +// converts the inputted audio to the format of dev +// returns 1 upon failure, 0 upon success. When 1 is returned *bufptr will be freed. Otherwise *bufptr is reallocated static int8_t audio_cvt(audiodevice const* dev, SDL_AudioSpec const* spec, uint8_t** bufptr, uint32_t* len) { // init the converter SDL_AudioCVT cvt; @@ -76,7 +78,7 @@ static int8_t audio_cvt(audiodevice const* dev, SDL_AudioSpec const* spec, uint8 // ensure the conversion buffer reallocation goes correctly if (cvt.buf == NULL) { - error("%s:%u something went wrong whilst growing the audio buffer whilst converting!", __FILE_NAME__, __LINE__); + error("%s:%u failed to reallocate the audio buffer to the new size of %u bytes!", __FILE_NAME__, __LINE__, cvt.len); free(*bufptr); return 1; }