Mercurial > hg > svapp
diff audioio/AudioCallbackPlaySource.cpp @ 250:0136555495ae integration_library
Merge from the default branch
author | Chris Cannam |
---|---|
date | Tue, 11 Oct 2011 11:16:38 +0100 |
parents | a99de38af73f f853dfb200de |
children |
line wrap: on
line diff
--- a/audioio/AudioCallbackPlaySource.cpp Mon Oct 10 17:31:30 2011 +0100 +++ b/audioio/AudioCallbackPlaySource.cpp Tue Oct 11 11:16:38 2011 +0100 @@ -902,8 +902,16 @@ void AudioCallbackPlaySource::setTargetSampleRate(size_t sr) { + bool first = (m_targetSampleRate == 0); + m_targetSampleRate = sr; initialiseConverter(); + + if (first && (m_stretchRatio != 1.f)) { + // couldn't create a stretcher before because we had no sample + // rate: make one now + setTimeStretch(m_stretchRatio); + } } void @@ -1073,6 +1081,8 @@ { m_stretchRatio = factor; + if (!getTargetSampleRate()) return; // have to make our stretcher later + if (m_timeStretcher || (factor == 1.f)) { // stretch ratio will be set in next process call if appropriate } else {