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)
This commit is contained in:
Glenn Maynard
2006-12-06 06:16:15 +00:00
parent 94b1849a29
commit b860c0c51c
+5 -3
View File
@@ -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. */