From b860c0c51c458c75acd0f751277f9e0376c84fd8 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 6 Dec 2006 06:16:15 +0000 Subject: [PATCH] RageSound::GetDataToPlay: always return a full block if possible (the sound filters are allowed to return less data than was requested, even if not EOF) --- stepmania/src/RageSound.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 43bec191e2..8c4c84bd14 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -375,7 +375,7 @@ bool RageSound::GetDataToPlay( int16_t *pBuffer, int iFrames, int64_t &iStreamFr iFramesStored = 0; iStreamFrame = m_iStreamFrame; - while( 1 ) + while( iFrames > 0 ) { /* Get a block of data. */ int iGotFrames = GetData( (char *) pBuffer, iFrames ); @@ -421,9 +421,11 @@ bool RageSound::GetDataToPlay( int16_t *pBuffer, int iFrames, int64_t &iStreamFr /* This block goes from iStreamFrame to iStreamFrame+iGotFrames. */ RageSoundUtil::Pan( pBuffer, iGotFrames, m_Param.m_Balance ); - iFramesStored = iGotFrames; - return true; + iFramesStored += iGotFrames; + iFrames -= iGotFrames; + pBuffer += iGotFrames * channels; } + return true; } /* Indicate that a block of audio data has been written to the device. */