Resampler code pulled back in from bqresample, with safer api

This commit is contained in:
Chris Cannam
2020-10-21 15:05:14 +01:00
parent 81629cf714
commit 3ddc35f7ae
5 changed files with 443 additions and 359 deletions

View File

@@ -672,9 +672,12 @@ RubberBandStretcher::Impl::configure()
if (m_channelData[c]->resampler) continue;
m_channelData[c]->resampler =
new Resampler(Resampler::FastestTolerable, 1, 4096 * 16,
m_debugLevel);
Resampler::Parameters params;
params.quality = Resampler::FastestTolerable;
params.maxBufferSize = 4096 * 16;
params.debugLevel = m_debugLevel;
m_channelData[c]->resampler = new Resampler(params, 1);
// rbs is the amount of buffer space we think we'll need
// for resampling; but allocate a sensible amount in case
@@ -813,9 +816,12 @@ RubberBandStretcher::Impl::reconfigure()
std::cerr << "WARNING: reconfigure(): resampler construction required in RT mode" << std::endl;
m_channelData[c]->resampler =
new Resampler(Resampler::FastestTolerable, 1, m_sWindowSize,
m_debugLevel);
Resampler::Parameters params;
params.quality = Resampler::FastestTolerable;
params.maxBufferSize = m_sWindowSize;
params.debugLevel = m_debugLevel;
m_channelData[c]->resampler = new Resampler(params, 1);
size_t rbs =
lrintf(ceil((m_increment * m_timeRatio * 2) / m_pitchScale));