snap ratio

This commit is contained in:
Glenn Maynard
2006-12-27 01:58:52 +00:00
parent 7cf7403e29
commit 102ccf3ed1
2 changed files with 12 additions and 0 deletions
@@ -57,6 +57,17 @@ int RageSoundReader_PitchChange::Read( char *pBuf, int iFrames )
return RageSoundReader_Filter::Read( pBuf, iFrames );
}
float RageSoundReader_PitchChange::GetStreamToSourceRatio() const
{
/* If m_fSpeedRatio is 1.0f and the underlying ratio is exactly 1.0,
* the ratio should be exactly 1. Rounding error prevents n * (1/n)
* from being exact. */
float fRatio = m_pSource->GetStreamToSourceRatio();
if( m_fSpeedRatio == 1.0f && fabsf(1.0f - fRatio) < 0.001f )
fRatio = 1.0f;
return fRatio;
}
bool RageSoundReader_PitchChange::SetProperty( const RString &sProperty, float fValue )
{
if( sProperty == "Rate" )
@@ -15,6 +15,7 @@ public:
virtual int Read( char *pBuf, int iFrames );
virtual bool SetProperty( const RString &sProperty, float fValue );
virtual float GetStreamToSourceRatio() const;
void SetSpeedRatio( float fRatio ) { m_fSpeedRatio = fRatio; }
void SetPitchRatio( float fRatio ) { m_fPitchRatio = fRatio; }