comparison dsp/rateconversion/Resampler.cpp @ 385:0d79970811c7

Add std::vector-returning process call
author Chris Cannam <c.cannam@qmul.ac.uk>
date Tue, 05 Nov 2013 16:36:53 +0000
parents 88971211795c
children 5f720340b0dd
comparison
equal deleted inserted replaced
384:279991b6ebe7 385:0d79970811c7
326 326
327 return outidx; 327 return outidx;
328 } 328 }
329 329
330 std::vector<double> 330 std::vector<double>
331 Resampler::process(const double *src, int n)
332 {
333 int maxout = int(ceil(double(n) * m_targetRate / m_sourceRate));
334 std::vector<double> out(maxout, 0.0);
335 int got = process(src, out.data(), n);
336 assert(got <= maxout);
337 if (got < maxout) out.resize(got);
338 return out;
339 }
340
341 std::vector<double>
331 Resampler::resample(int sourceRate, int targetRate, const double *data, int n) 342 Resampler::resample(int sourceRate, int targetRate, const double *data, int n)
332 { 343 {
333 Resampler r(sourceRate, targetRate); 344 Resampler r(sourceRate, targetRate);
334 345
335 int latency = r.getLatency(); 346 int latency = r.getLatency();