Hi there,
I’m trying to upsample an audioBuffer. I’m using this code:
auto oversampling = new dsp::Oversampling<float> (1, 3, dsp::Oversampling<float>::filterHalfBandFIREquiripple, true);
dsp::AudioBlock<float> block (buffer);
dsp::AudioBlock<float> oversampledBlock = oversampling->processSamplesUp(block);
block is created and has one channel, with samples in it.
however oversampledBlock has 0 channels, and 0 samples.
What am I doing wrong?
Thanks!
There is a method initProcessing(number_of_input_samples)
that apparently must be called before any processing to allocate the required buffers. Docs
auto oversampling = new dsp::Oversampling<float> (1, 3, dsp::Oversampling<float>::filterHalfBandFIREquiripple, true);
dsp::AudioBlock<float> block (buffer);
oversampling -> initProcessing(buffer.getNumSamples());
dsp::AudioBlock<float> oversampledBlock = oversampling->processSamplesUp(block);
I also recommend using std::make_unique<dsp::Oversampling<float>>(...)
instead of new here.
1 Like