mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-15 15:58:14 +00:00
Fix for short non-looping sounds (#1067)
Short non-looping sounds can sometimes think they need to keep playing and will output their first few frames again. This helps to break out of all the loops instead of just this one.
This commit is contained in:
@@ -324,6 +324,12 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const
|
|||||||
framesToRead -= framesJustRead;
|
framesToRead -= framesJustRead;
|
||||||
framesRead += framesJustRead;
|
framesRead += framesJustRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!audioBuffer->playing)
|
||||||
|
{
|
||||||
|
framesRead = frameCount;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// If we weren't able to read all the frames we requested, break
|
// If we weren't able to read all the frames we requested, break
|
||||||
if (framesJustRead < framesToReadRightNow)
|
if (framesJustRead < framesToReadRightNow)
|
||||||
|
Reference in New Issue
Block a user