simplify EOF handling
This commit is contained in:
@@ -312,6 +312,9 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames )
|
|||||||
++m_iNextSound;
|
++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. */
|
/* Clamp iFrames to the beginning of the next sound we need to start. */
|
||||||
if( m_iNextSound < m_aSounds.size() )
|
if( m_iNextSound < m_aSounds.size() )
|
||||||
{
|
{
|
||||||
@@ -321,9 +324,6 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames )
|
|||||||
iFrames = min( iFramesToRead, iFrames );
|
iFrames = min( iFramesToRead, iFrames );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iFrames == 0 )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if( m_apActiveSounds.size() == 1 &&
|
if( m_apActiveSounds.size() == 1 &&
|
||||||
m_apActiveSounds.front()->pSound->GetNumChannels() == m_iChannels &&
|
m_apActiveSounds.front()->pSound->GetNumChannels() == m_iChannels &&
|
||||||
m_apActiveSounds.front()->pSound->GetSampleRate() == m_iActualSampleRate )
|
m_apActiveSounds.front()->pSound->GetSampleRate() == m_iActualSampleRate )
|
||||||
@@ -387,8 +387,6 @@ int RageSoundReader_Chain::Read( char *pBuffer, int iFrames )
|
|||||||
mix.read( (int16_t *) pBuffer );
|
mix.read( (int16_t *) pBuffer );
|
||||||
m_iCurrentFrame += iMaxFramesRead;
|
m_iCurrentFrame += iMaxFramesRead;
|
||||||
|
|
||||||
if( iMaxFramesRead == 0 )
|
|
||||||
return END_OF_FILE;
|
|
||||||
return iMaxFramesRead;
|
return iMaxFramesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user