diff options
| author | jbosh <[email protected]> | 2020-01-14 00:15:52 -0800 |
|---|---|---|
| committer | Ray <[email protected]> | 2020-01-14 09:15:52 +0100 |
| commit | 019434a37e02aa3ae319d5c7254c97a8bae42227 (patch) | |
| tree | b276bc718e74fbbb3606de1bf186c9f9b1b00c1f /src | |
| parent | 22b771328750a5baf138b0a125ecc21df1b1b49c (diff) | |
| download | raylib-019434a37e02aa3ae319d5c7254c97a8bae42227.tar.gz raylib-019434a37e02aa3ae319d5c7254c97a8bae42227.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/raudio.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/raudio.c b/src/raudio.c index b94f0e65..9fde6e95 100644 --- a/src/raudio.c +++ b/src/raudio.c @@ -324,6 +324,12 @@ static void OnSendAudioDataToDevice(ma_device *pDevice, void *pFramesOut, const framesToRead -= framesJustRead; framesRead += framesJustRead; } + + if (!audioBuffer->playing) + { + framesRead = frameCount; + break; + } // If we weren't able to read all the frames we requested, break if (framesJustRead < framesToReadRightNow) |
