From 451629890150032ab230ed4959db5f4a77daf287 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 22 Dec 2006 06:01:49 +0000 Subject: [PATCH] simplify EOF handling --- stepmania/src/RageSoundReader_Chain.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stepmania/src/RageSoundReader_Chain.cpp b/stepmania/src/RageSoundReader_Chain.cpp index 9f944fb340..d512c2d8f6 100644 --- a/stepmania/src/RageSoundReader_Chain.cpp +++ b/stepmania/src/RageSoundReader_Chain.cpp @@ -312,6 +312,9 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames ) ++m_iNextSound; } + if( m_iNextSound == m_aSounds.size() && m_apActiveSounds.empty() ) + return END_OF_FILE; + /* Clamp iFrames to the beginning of the next sound we need to start. */ if( m_iNextSound < m_aSounds.size() ) { @@ -321,9 +324,6 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames ) iFrames = min( iFramesToRead, iFrames ); } - if( iFrames == 0 ) - return 0; - if( m_apActiveSounds.size() == 1 && m_apActiveSounds.front()->pSound->GetNumChannels() == m_iChannels && m_apActiveSounds.front()->pSound->GetSampleRate() == m_iActualSampleRate ) @@ -387,8 +387,6 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames ) mix.read( (int16_t *) pBuffer ); m_iCurrentFrame += iMaxFramesRead; - if( iMaxFramesRead == 0 ) - return END_OF_FILE; return iMaxFramesRead; }