From 6cfd553f336e274c09d0fb228b54e95fdc55f011 Mon Sep 17 00:00:00 2001 From: Quinn Date: Tue, 25 Mar 2025 11:10:36 +0100 Subject: [PATCH] fix: don't multiply the buffer length, as it's already the length of the audio buffer in bytes --- src/window/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window/audio.c b/src/window/audio.c index ce6c647..82fa830 100644 --- a/src/window/audio.c +++ b/src/window/audio.c @@ -73,7 +73,7 @@ static int8_t audio_cvt(audiodevice const* dev, SDL_AudioSpec const* spec, uint8 } else if (!cvt.needed) { // ensure the conversion is necessary return 0; } - cvt.len = (*len) * spec->channels; // calculate the size of the source data in bytes by multiplying the length by the amount of channels (warn: uint32_t -> int32_t) + cvt.len = (*len); // specify the length of the source data buffer in bytes (warn: uint32_t -> int32_t) cvt.buf = realloc(*bufptr, cvt.len * cvt.len_mult); // grow the inputted buffer for the conversion // ensure the conversion buffer reallocation goes correctly