so i am working on an asymmetrical overdrive plugin (a copy of Logic Pro Clip Distortion). i have two dsp::Gain’s one titled leftGain the other rightGain.
in my process block this is my code
float t = *apvts.getRawParameterValue("Drive"); // T = Total drive
float p = *apvts.getRawParameterValue("Symmetry"); // P = Symmetry Percentage (0.5 * T) = 50% of drive
float rightDrive = 0.f;
float leftDrive = 0.f;
if (p < 0.5f)
{
rightDrive = (1.0f - p) * t;
leftDrive = p * t;
}
if (p > 0.5f)
{
rightDrive = p * t;
leftDrive = (1.0f - p) * t;
}
if (p == 0.5f)
{
rightDrive = t * p;
leftDrive = t * p;
}
leftGain.setGainDecibels(leftDrive);
rightGain.setGainDecibels(rightDrive);
juce::dsp::AudioBlock<float> block(buffer);
auto& leftBlock = block.getSingleChannelBlock(0);
auto& rightBlock = block.getSingleChannelBlock(1);
juce::dsp::ProcessContextReplacing<float> leftContext(leftBlock);
juce::dsp::ProcessContextReplacing<float> rightContext(rightBlock);
leftGain.process(leftContext);
rightGain.process(rightContext);
the problem i have is while symmetry is 0.50 the signal is centered, when the slider i have is dragged up so 0.50 is increased, the signal starts to pan to the right, not process the right more than left but pan the actual signal to the right.
similarly when the slider is dragged down the signal is panned right again. clearly i am doing something wrong but i can’t figure it out.
any thoughts? thanks