Hi all, this is most likely a fundamental misunderstanding or some stupid random mistake I’ve made somewhere as I’m pretty new to JUCE and plugin development in general.
So my problem is that I’ve made a simple distortion plugin using the projucer template for audio plugins and it seems to function ok (audio in, audio out, some distortion). However, there is a constant output wether audio is running through or not of a non-audible signal passing through the plugin that is being processed like a DC offset.
This also causes an audible click to be heard on adding the plugin and switching it on and off. Also a “clicking” like sound is heard on adjusting the sliders on the GUI.
I’ve included my code from the main processing block below and I am unsure wether the issue stems from using both an input and output pointer, or wether its the processing itself that I have attempted.
for (auto channel = 0; channel < totalNumOutputChannels; ++channel){
auto* channelData = buffer.getWritePointer (channel);
auto* InputData = buffer.getReadPointer(channel);
for (int currentSample = 0; currentSample < buffer.getNumSamples(); ++currentSample)
{
//Do processing
//try chebychev 2x^2 - 1
channelData[currentSample] = ((LevelValue * ((InputData[currentSample]))
+ (LevelValue * DistortionValue * (2 * pow(InputData[currentSample], 2) - 1))))/2;
}
}
Any feedback will be most appreciated!