These attempt to flush buffers and go back to reading directly if ratios

are set back to 1.  They don't work; the speed shift buffer won't line up
perfectly for all channels, and the resampler would need to be lined up
with the window and lerped.  Make these only read directly if the buffers
are empty, so these filters are cheap if their ratios are never used.  Fixes
clicks when moving the ratio around 1.0.
This commit is contained in:
Glenn Maynard
2006-12-27 09:19:02 +00:00
parent ad5b3543a6
commit 3551367fe4
2 changed files with 2 additions and 47 deletions
@@ -242,7 +242,7 @@ int RageSoundReader_SpeedChange::Read( char *buf, int iFrames )
// m_iDataBufferAvailFrames-m_iCorrelatedPos < GetWindowSizeFrames when flushing
int iCursorAvail = GetCursorAvail();
if( iCursorAvail == 0 && m_fTrailingSpeedRatio == m_fSpeedRatio && m_fSpeedRatio == 1.0f )
if( m_iDataBufferAvailFrames == 0 && m_fTrailingSpeedRatio == m_fSpeedRatio && m_fSpeedRatio == 1.0f )
{
/* Fast path: the buffer is empty, and we're not scaling the audio. Read directly
* into the output buffer, to eliminate memory and copying overhead. */