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
+3 -3
View File
@@ -63,7 +63,7 @@ bool RageSoundReader_Preload::Open( RageSoundReader *pSource )
{
float fSecs = iLen / 1000.f;
int iFrames = std::lrint( fSecs * m_iSampleRate ); /* seconds -> frames */
int iFrames = static_cast<int>((fSecs * m_iSampleRate) + 0.5 ); /* seconds -> frames */
int iSamples = unsigned( iFrames * m_iChannels ); /* frames -> samples */
if( iSamples > iMaxSamples )
return false; /* Don't bother trying to preload it. */
@@ -126,7 +126,7 @@ int RageSoundReader_Preload::GetLength_Fast() const
int RageSoundReader_Preload::SetPosition( int iFrame )
{
m_iPosition = iFrame;
m_iPosition = std::lrint(m_iPosition / m_fRate);
m_iPosition = static_cast<int>((m_iPosition / m_fRate) + 0.5);
if( m_iPosition >= int(m_Buffer->size() / framesize) )
{
@@ -139,7 +139,7 @@ int RageSoundReader_Preload::SetPosition( int iFrame )
int RageSoundReader_Preload::GetNextSourceFrame() const
{
return std::lrint(m_iPosition * m_fRate);
return static_cast<int>((m_iPosition * m_fRate) + 0.5);
}
int RageSoundReader_Preload::Read( float *pBuffer, int iFrames )