Replace lrint(x) with static_cast(x+0.5)

Update 9 files

Update RageSoundReader_Extend.cpp
Update RageSoundReader_Preload.cpp
Update RageSoundUtil.cpp
Update RageSoundReader_ThreadedBuffer.cpp
Update RageSoundReader_SpeedChange.cpp
Update RageSoundReader_Resample_Good.cpp
Update RageSoundReader_Merge.cpp
Update RageSoundReader_Chain.cpp
Update RageSoundMixBuffer.cpp
This commit is contained in:
sukibaby
2024-05-03 23:17:59 -07:00
committed by teejusb
parent bd075c42a1
commit 2e2d49393b
9 changed files with 19 additions and 19 deletions
+4 -4
View File
@@ -215,7 +215,7 @@ int RageSoundReader_Merge::Read( float *pBuffer, int iFrames )
/* A sound is being delayed to resync it; clamp the number of frames we
* read now, so we don't advance past it. */
int iMaxSourceFramesToRead = aNextSourceFrames[i] - iMinPosition;
int iMaxStreamFramesToRead = std::lrint( iMaxSourceFramesToRead / m_fCurrentStreamToSourceRatio );
int iMaxStreamFramesToRead = static_cast<int>((iMaxSourceFramesToRead / m_fCurrentStreamToSourceRatio) + 0.5 );
iFrames = std::min( iFrames, iMaxStreamFramesToRead );
// LOG->Warn( "RageSoundReader_Merge: sound positions moving at different rates" );
}
@@ -227,7 +227,7 @@ int RageSoundReader_Merge::Read( float *pBuffer, int iFrames )
RageSoundReader *pSound = m_aSounds.front();
iFrames = pSound->Read( pBuffer, iFrames );
if( iFrames > 0 )
m_iNextSourceFrame += std::lrint( iFrames * m_fCurrentStreamToSourceRatio );
m_iNextSourceFrame += static_cast<int>((iFrames * m_fCurrentStreamToSourceRatio) + 0.5 );
aNextSourceFrames.front() = pSound->GetNextSourceFrame();
aRatios.front() = pSound->GetStreamToSourceRatio();
return iFrames;
@@ -249,9 +249,9 @@ int RageSoundReader_Merge::Read( float *pBuffer, int iFrames )
// if( i == 0 )
//LOG->Trace( "*** %i", Difference(aNextSourceFrames[i], m_iNextSourceFrame + std::lrint(iFramesRead * aRatios[i])) );
if( Difference(aNextSourceFrames[i], m_iNextSourceFrame + std::lrint(iFramesRead * aRatios[i])) > ERROR_CORRECTION_THRESHOLD )
if( Difference(aNextSourceFrames[i], m_iNextSourceFrame + static_cast<int>((iFramesRead * aRatios[i]) + 0.5)) > ERROR_CORRECTION_THRESHOLD )
{
LOG->Trace( "*** hurk %i", Difference(aNextSourceFrames[i], m_iNextSourceFrame + std::lrint(iFramesRead * aRatios[i])) );
LOG->Trace( "*** hurk %i", Difference(aNextSourceFrames[i], m_iNextSourceFrame + static_cast<int>((iFramesRead * aRatios[i]) + 0.5 )) );
break;
}