probably fix crash with mono songs
This commit is contained in:
@@ -123,7 +123,7 @@ int RageSoundReader_Extend::Read( float *pBuffer, int iFrames )
|
||||
const int iEndSecond = m_iPositionFrames + iFramesRead;
|
||||
const float fStartVolume = SCALE( iStartSecond, iFullVolumePositionFrames, iSilencePositionFrames, 1.0f, 0.0f );
|
||||
const float fEndVolume = SCALE( iEndSecond, iFullVolumePositionFrames, iSilencePositionFrames, 1.0f, 0.0f );
|
||||
RageSoundUtil::Fade( pBuffer, iFramesRead, fStartVolume, fEndVolume );
|
||||
RageSoundUtil::Fade( pBuffer, iFramesRead, this->GetNumChannels(), fStartVolume, fEndVolume );
|
||||
}
|
||||
|
||||
m_iPositionFrames += iFramesRead;
|
||||
|
||||
@@ -48,7 +48,7 @@ void RageSoundUtil::Pan( float *buffer, int frames, float fPos )
|
||||
}
|
||||
}
|
||||
|
||||
void RageSoundUtil::Fade( float *pBuffer, int iFrames, float fStartVolume, float fEndVolume )
|
||||
void RageSoundUtil::Fade( float *pBuffer, int iFrames, int iChannels, float fStartVolume, float fEndVolume )
|
||||
{
|
||||
/* If the whole buffer is full volume, skip. */
|
||||
if( fStartVolume > .9999f && fEndVolume > .9999f )
|
||||
@@ -59,7 +59,7 @@ void RageSoundUtil::Fade( float *pBuffer, int iFrames, float fStartVolume, float
|
||||
float fVolPercent = SCALE( iFrame, 0, iFrames, fStartVolume, fEndVolume );
|
||||
|
||||
fVolPercent = clamp( fVolPercent, 0.f, 1.f );
|
||||
for( int i = 0; i < channels; ++i )
|
||||
for( int i = 0; i < iChannels; ++i )
|
||||
{
|
||||
*pBuffer *= fVolPercent;
|
||||
pBuffer++;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace RageSoundUtil
|
||||
{
|
||||
void Attenuate( float *pBuf, int iSamples, float fVolume );
|
||||
void Pan( float *pBuffer, int iFrames, float fPos );
|
||||
void Fade( float *pBuffer, int iFrames, float fStartVolume, float fEndVolume );
|
||||
void Fade( float *pBuffer, int iFrames, int iChannels, float fStartVolume, float fEndVolume );
|
||||
void ConvertMonoToStereoInPlace( float *pBuffer, int iFrames );
|
||||
void ConvertNativeInt16ToFloat( const int16_t *pFrom, float *pTo, int iSamples );
|
||||
void ConvertFloatToNativeInt16( const float *pFrom, int16_t *pTo, int iSamples );
|
||||
|
||||
Reference in New Issue
Block a user