From 87cba64986ace36599ff803792fd2b1175f4df92 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 10 Dec 2006 07:34:35 +0000 Subject: [PATCH] ratio fixup --- stepmania/src/RageSoundReader_PitchChange.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stepmania/src/RageSoundReader_PitchChange.cpp b/stepmania/src/RageSoundReader_PitchChange.cpp index 76125ae348..25e1943c43 100644 --- a/stepmania/src/RageSoundReader_PitchChange.cpp +++ b/stepmania/src/RageSoundReader_PitchChange.cpp @@ -40,10 +40,17 @@ int RageSoundReader_PitchChange::Read( char *pBuf, int iFrames ) * speed changer new ratio to put a new ratio into effect, tell the resampler * to do the same. This way, changes to the ratios will take effect in both * the resampler and speed changer as closely together as possible. */ + float fRate = GetStreamToSourceRatio(); + m_pSpeedChange->SetSpeedRatio( m_fSpeedRatio / m_fPitchRatio ); if( m_pSpeedChange->NextReadWillStep() ) m_pResample->SetRate( m_fPitchRatio ); + /* We just applied a new speed, and it caused the ratio to change. Return + * no data, so the caller can see the new ratio. */ + if( fRate != GetStreamToSourceRatio() ) + return 0; + return RageSoundReader_Filter::Read( pBuf, iFrames ); }