Fixes to reset calls, thanks to Justin Frankel

This commit is contained in:
Chris Cannam
2017-09-26 09:51:22 +01:00
parent 51ef8a63ff
commit 5eb13cb947
4 changed files with 13 additions and 1 deletions

View File

@@ -404,6 +404,10 @@ StretchCalculator::reset()
{
m_prevDf = 0;
m_divergence = 0;
m_recovery = 0;
m_prevRatio = 1.0;
m_transientAmnesty = 0;
m_keyFrameMap.clear();
}
std::vector<StretchCalculator::Peak>

View File

@@ -242,7 +242,7 @@ RubberBandStretcher::Impl::reset()
m_emergencyScavenger.scavenge();
if (m_stretchCalculator) {
m_stretchCalculator->setKeyFrameMap(std::map<size_t, size_t>());
m_stretchCalculator->reset();
}
for (size_t c = 0; c < m_channels; ++c) {

View File

@@ -1033,6 +1033,8 @@ D_Speex::resampleInterleaved(const float *const R__ in,
void
D_Speex::reset()
{
m_lastratio = -1.0; // force reset of ratio
m_initial = true;
speex_resampler_reset_mem(m_resampler);
}

View File

@@ -1236,6 +1236,12 @@ int speex_resampler_reset_mem(SpeexResamplerState *st)
st->mem[i] = 0;
}
for (i = 0; i < st->nb_channels; i++) {
st->last_sample[i] = 0;
st->magic_samples[i] = 0;
st->samp_frac_num[i] = 0;
}
return RESAMPLER_ERR_SUCCESS;
}