REVIEWED: Formating, tested sound examples

This commit is contained in:
Ray
2026-02-21 09:09:43 +01:00
parent 0c91f230fd
commit 11e3e6e0b9

View File

@ -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
}
}