From 11e3e6e0b994d0543cb83e253438e08402dba014 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 21 Feb 2026 09:09:43 +0100 Subject: [PATCH] REVIEWED: Formating, tested sound examples --- src/raudio.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/raudio.c b/src/raudio.c index 4866f32f9..2740462b4 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -2378,10 +2378,7 @@ static void OnLog(void *pUserData, ma_uint32 level, const char *pMessage) static ma_uint32 ReadAudioBufferFramesInInternalFormat(AudioBuffer *audioBuffer, void *framesOut, ma_uint32 frameCount) { // Don't read anything if the sound is not playing - if (!audioBuffer->playing) - { - return 0; - } + if (!audioBuffer->playing) return 0; // Using audio buffer callback if (audioBuffer->callback) @@ -2519,16 +2516,9 @@ static ma_uint32 ReadAudioBufferFramesInMixingFormat(AudioBuffer *audioBuffer, f // When the guess is overestimated, that's when it gets more complicated. In this case, any overflow // needs to be stored in a buffer for later processing by the next read. ma_uint32 estimatedInputFrameCount = (ma_uint32)(((float)audioBuffer->converter.resampler.sampleRateIn / audioBuffer->converter.resampler.sampleRateOut) * outputFramesToProcessThisIteration); - if (estimatedInputFrameCount == 0) - { - estimatedInputFrameCount = 1; // Make sure at least one input frame is read. - } + if (estimatedInputFrameCount == 0) estimatedInputFrameCount = 1; // Make sure at least one input frame is read. + if (estimatedInputFrameCount > inputBufferFrameCap) estimatedInputFrameCount = inputBufferFrameCap; - if (estimatedInputFrameCount > inputBufferFrameCap) - { - estimatedInputFrameCount = inputBufferFrameCap; - } - ma_uint32 inputFramesInInternalFormatCount = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, estimatedInputFrameCount); ma_uint64 inputFramesProcessedThisIteration = inputFramesInInternalFormatCount; @@ -2553,9 +2543,7 @@ static ma_uint32 ReadAudioBufferFramesInMixingFormat(AudioBuffer *audioBuffer, f audioBuffer->converterResidualCount = residualFrameCount; } - if (inputFramesInInternalFormatCount < estimatedInputFrameCount) { - break; // Reached the end of the sound - } + if (inputFramesInInternalFormatCount < estimatedInputFrameCount) break; // Reached the end of the sound } }