I have a distortion plugin that I’m working on for which I’d like to oversample (the distortion process is introducing aliasing). As a first step, I wanted to stick a
ResamplingAudioSource at the end of my AudioSource signal chain and set the resamplingRatio to 1.0 just to verify that I could get my signal flowing through the ResamplingAudioSource…
So I did that, but no matter what I try, I just get silence coming out of the ResamplingAudioSource. I’ve tried narrowing down the problem but I can’t even seem to find a small case that works, however, as long as I take the ResamplingAudioSource out of the chain (no matter where I tried to put it) I get signal flowing as expected.
I’m not sure how to explain this any better than to provide a diff of my working tree:
diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index fcb4b20..2a3a8c3 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -32,8 +32,10 @@ MxzeroAudioProcessor::MxzeroAudioProcessor() waveshaper = new WaveshaperAudioSource(identitySource, false); smoothingFilter = new PoleZeroFilterAudioSource(waveshaper, false); - dcBlocker = new PoleZeroFilterAudioSource(smoothingFilter, false); + downsampler = new ResamplingAudioSource(smoothingFilter, false); + dcBlocker = new PoleZeroFilterAudioSource(downsampler, false); + downsampler->setResamplingRatio(1.0); dcBlocker->setBlockZero(); // Set up the rotary parameters @@ -137,6 +139,7 @@ void MxzeroAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock waveshaper->prepareToPlay(samplesPerBlock, sampleRate); smoothingFilter->prepareToPlay(samplesPerBlock, sampleRate); dcBlocker->prepareToPlay(samplesPerBlock, sampleRate); + downsampler->prepareToPlay(samplesPerBlock, sampleRate); } void MxzeroAudioProcessor::releaseResources() @@ -147,6 +150,7 @@ void MxzeroAudioProcessor::releaseResources() smoothingFilter->releaseResources(); dcBlocker->releaseResources(); + downsampler->releaseResources(); } #ifndef JucePlugin_PreferredChannelConfigurations
And then in my
processBlock method I ask the
getNextAudioBlock. The change seems really simple I have no idea why I’m getting silence; has anybody experienced trouble like this here?
Any input here would be greatly appreciated. Thank you!
EDIT: If it’s helpful to see the header file changes, I’d be happy to add that here too. All I’ve done is add a private member variable