RageSoundReader::Read(char *) -> int16_t *. This was originally

char * based on the idea of supporting more than one sample type.
I don't plan to do that (though I may change the sample type to float
or int32).
This commit is contained in:
Glenn Maynard
2007-01-20 01:10:24 +00:00
parent 29edd8be6c
commit fd4b5f93bb
29 changed files with 94 additions and 97 deletions
@@ -647,12 +647,10 @@ int RageSoundReader_Resample_Good::SetPosition( int iFrame )
return m_pSource->SetPosition( iFrame );
}
int RageSoundReader_Resample_Good::Read( char *pBuf_, int iFrames )
int RageSoundReader_Resample_Good::Read( int16_t *pBuf, int iFrames )
{
int iChannels = m_apResamplers.size();
int16_t *pBuf = (int16_t *) pBuf_;
int iFramesRead = 0;
/* If the ratio is 1:1, then we're effectively disabled, and we can read
@@ -661,13 +659,13 @@ int RageSoundReader_Resample_Good::Read( char *pBuf_, int iFrames )
GetFactors( iDownFactor, iUpFactor );
if( m_apResamplers[0]->GetFilled() == 0 && iDownFactor == iUpFactor && GetRate() == 1.0f )
return m_pSource->Read( pBuf_, iFrames );
return m_pSource->Read( pBuf, iFrames );
{
int iFramesNeeded = m_apResamplers[0]->NumInputsForOutputSamples(iFrames);
int16_t *pTmpBuf = (int16_t *) alloca( iFramesNeeded * sizeof(int16_t) * iChannels );
ASSERT( pTmpBuf );
int iFramesIn = m_pSource->Read( (char *) pTmpBuf, iFramesNeeded );
int iFramesIn = m_pSource->Read( pTmpBuf, iFramesNeeded );
if( iFramesIn < 0 )
return iFramesIn;