mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-21 21:23:35 -05:00
REVIEWED: Formating, tested sound examples
This commit is contained in:
20
src/raudio.c
20
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,15 +2516,8 @@ 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 > inputBufferFrameCap)
|
||||
{
|
||||
estimatedInputFrameCount = inputBufferFrameCap;
|
||||
}
|
||||
if (estimatedInputFrameCount == 0) estimatedInputFrameCount = 1; // Make sure at least one input frame is read.
|
||||
if (estimatedInputFrameCount > inputBufferFrameCap) estimatedInputFrameCount = inputBufferFrameCap;
|
||||
|
||||
ma_uint32 inputFramesInInternalFormatCount = ReadAudioBufferFramesInInternalFormat(audioBuffer, inputBuffer, estimatedInputFrameCount);
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user