I am making a fairly generic audio plugin, writing some of my own dsp functions as a way of learning them. Having some issues with the oversampling class that must be from a misunderstanding on my end on how data is organized by audioblock.
I construct the oversampler in the header file of the PluginProcessor
juce::dsp::Oversampling<float> oversampling{ getTotalNumOutputChannels(), 1, juce::dsp::Oversampling<float>::FilterType::filterHalfBandFIREquiripple, false, true};
in prepareToPlay
int numChannels = getNumInputChannels();
oversampling.numChannels = getTotalNumInputChannels();
oversampling.initProcessing(samplesPerBlock);
oversampling.reset();
float oversampledRate = sampleRate * 2.0;
setLatencySamples(oversampling.getLatencyInSamples());
Finally in processBlock
juce::dsp::AudioBlock<float> block(buffer);
auto oversampledBlock = oversampling.processSamplesUp(block);
int numSamples = oversampledBlock.getNumSamples() / 2;
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* channelData = oversampledBlock.getChannelPointer(channel);
dspFunction.processBlock(channelData, numSamples, channel);
}
oversampling.processSamplesDown(block);
This results in, I think, every other block being processed? Which sounds like an issue with numSamples but when I get rid of that division, the plugin immediately crashes.
This is my first post so hopefully my formatting is right and I’ve included enough information