MCPcopy Create free account
hub / github.com/audacity/audacity / processSamples

Method processSamples

lib-src/soundtouch/source/SoundTouch/RateTransposer.cpp:279–306  ·  view source on GitHub ↗

Transposes sample rate by applying anti-alias filter to prevent folding. Returns amount of samples returned in the "dest" buffer. The maximum amount of samples that can be returned at a time is set by the 'set_returnBuffer_size' function.

Source from the content-addressed store, hash-verified

277// The maximum amount of samples that can be returned at a time is set by
278// the 'set_returnBuffer_size' function.
279void RateTransposer::processSamples(const SAMPLETYPE *src, uint nSamples)
280{
281 uint count;
282 uint sizeReq;
283
284 if (nSamples == 0) return;
285 assert(pAAFilter);
286
287 // If anti-alias filter is turned off, simply transpose without applying
288 // the filter
289 if (bUseAAFilter == FALSE)
290 {
291 sizeReq = (uint)((float)nSamples / fRate + 1.0f);
292 count = transpose(outputBuffer.ptrEnd(sizeReq), src, nSamples);
293 outputBuffer.putSamples(count);
294 return;
295 }
296
297 // Transpose with anti-alias filter
298 if (fRate < 1.0f)
299 {
300 upsample(src, nSamples);
301 }
302 else
303 {
304 downsample(src, nSamples);
305 }
306}
307
308
309// Transposes the sample rate of the given samples using linear interpolation.

Callers

nothing calls this directly

Calls 2

ptrEndMethod · 0.80
putSamplesMethod · 0.45

Tested by

no test coverage detected