Avoid RatioMostlyFixed in RealTime mode, it can lead to unpleasant surprises

This commit is contained in:
Chris Cannam
2022-08-02 16:22:24 +01:00
parent d211121701
commit 9fff2836c6

View File

@@ -276,14 +276,12 @@ R3Stretcher::createResampler()
resamplerParameters.maxBufferSize = m_guideConfiguration.longestFftSize; resamplerParameters.maxBufferSize = m_guideConfiguration.longestFftSize;
if (isRealTime()) { if (isRealTime()) {
if (m_parameters.options & // If we knew the caller would never change ratio, we could
RubberBandStretcher::OptionPitchHighConsistency) { // supply RatioMostlyFixed - but it can have such overhead
resamplerParameters.dynamism = Resampler::RatioOftenChanging; // when the ratio *does* change that a single call would kill
resamplerParameters.ratioChange = Resampler::SmoothRatioChange; // RT use, so it's not a good idea
} else { resamplerParameters.dynamism = Resampler::RatioOftenChanging;
resamplerParameters.dynamism = Resampler::RatioMostlyFixed; resamplerParameters.ratioChange = Resampler::SmoothRatioChange;
resamplerParameters.ratioChange = Resampler::SmoothRatioChange;
}
} else { } else {
resamplerParameters.dynamism = Resampler::RatioMostlyFixed; resamplerParameters.dynamism = Resampler::RatioMostlyFixed;
resamplerParameters.ratioChange = Resampler::SuddenRatioChange; resamplerParameters.ratioChange = Resampler::SuddenRatioChange;