Changed RSR_WAV and RSR_Resample_Good back to using alloca because only gcc/C99 like dynamic arrays. RSR_SpeedChange now uses new/delete in spite of the performance.

This commit is contained in:
Kyzentun Keeslala
2016-06-21 20:09:16 -06:00
parent d4926506f9
commit 8796946b4f
3 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -667,7 +667,7 @@ int RageSoundReader_Resample_Good::Read( float *pBuf, int iFrames )
{
int iFramesNeeded = m_apResamplers[0]->NumInputsForOutputSamples(iFrames);
float pTmpBuf[iFramesNeeded * iChannels];
float *pTmpBuf = (float *) alloca( iFramesNeeded * sizeof(float) * iChannels );
int iFramesIn = m_pSource->Read( pTmpBuf, iFramesNeeded );
if( iFramesIn < 0 )
return iFramesIn;
+3 -1
View File
@@ -89,10 +89,11 @@ int RageSoundReader_SpeedChange::FillData( int iMaxFrames )
if( iBytesToRead <= 0 )
return m_iDataBufferAvailFrames;
float pTempBuffer[iBytesToRead/sizeof(float)];
float* pTempBuffer= new float[iBytesToRead/sizeof(float)];
int iGotFrames = m_pSource->Read( pTempBuffer, iFramesToRead );
if( iGotFrames < 0 )
{
delete[] pTempBuffer;
if( iGotFrames == END_OF_FILE && m_iDataBufferAvailFrames )
return m_iDataBufferAvailFrames;
return iGotFrames;
@@ -114,6 +115,7 @@ int RageSoundReader_SpeedChange::FillData( int iMaxFrames )
++pOut;
}
}
delete[] pTempBuffer;
m_iDataBufferAvailFrames += iGotFrames;
}
+1 -2
View File
@@ -288,8 +288,7 @@ public:
/* We've read the block header; read the rest. Don't read past the end of the data chunk. */
int iMaxSize = min( (int) m_WavData.m_iBlockAlign - 7 * m_WavData.m_iChannels, (m_WavData.m_iDataChunkSize+m_WavData.m_iDataChunkPos) - m_File.Tell() );
char cBuf[iMaxSize];
char* pBuf= cBuf;
char *pBuf = (char *) alloca( iMaxSize );
int iBlockSize = m_File.Read( pBuf, iMaxSize );
if( iBlockSize == 0 )