Convolution plugin audiobuffer problems

Hi there! This is my first post and it’s my first week coding Juce (or anything C at all), so excuse me if it is too obvious.

I’m making a binaural convolution plugin, meaning I have to do two stereo convolutions in parallel and then merge them into the main buffer.

For the moment I have this in ProcessBlock:

juce::AudioProcessor::setLatencySamples (4096);
buffer.applyGain(0.85f);
const auto BLength = buffer.getNumSamples();

bufferL.copyFrom(0, 0, buffer, 0, 0, BLength);
bufferL.copyFrom(1, 0, buffer, 0, 0, BLength);
bufferR.copyFrom(0, 0, buffer, 1, 0, BLength);
bufferR.copyFrom(1, 0, buffer, 1, 0, BLength);

juce::dsp::AudioBlock<float> blockL (bufferL);
juce::dsp::AudioBlock<float> blockR (bufferR);
convL.process (juce::dsp::ProcessContextReplacing<float> (blockL) );
convR.process (juce::dsp::ProcessContextReplacing<float> (blockR) );

bufferF.copyFrom(0, 0, bufferL, 0, 0, BLength);
bufferF.copyFrom(1, 0, bufferL, 1, 0, BLength);
bufferF.addFrom(0, 0, bufferR, 0, 0, BLength);
bufferF.addFrom(1, 0, bufferR, 1, 0, BLength);

for(int sample=0; sample < buffer.getNumSamples(); ++sample)
{
    for(int channel=0; channel<buffer.getNumChannels(); ++channel)
    {
        float* channelData = buffer.getWritePointer(channel);
        const float* outData = bufferF.getReadPointer(channel);
        channelData[sample] = outData[sample];
    }
}

It works nice in DAWs like Studio One and Reaper, but if I try to load it into Rogue Amoeba’s SoundSource, terrible sounds happen, like some feedback clipping the channels. If I bypass the convolution it works (with no processing of course). What I am missing?

Many thanks!

I tried using DryWetMixer to mix to buffer without creating a loop. It still makes the same error, clipping like crazy. There is something crashing by mixing the two convolutions… any tips?

juce::AudioProcessor::setLatencySamples (4096);
const auto BLength = buffer.getNumSamples();

//buffer copy to bufferL
bufferL.copyFrom(0, 0, buffer, 0, 0, BLength);
bufferL.copyFrom(1, 0, buffer, 0, 0, BLength);

//buffer channel L = R
buffer.copyFrom(0, 0, buffer, 1, 0, BLength);

mixer.setWetMixProportion(0.5);
mixer.setWetLatency (convR.getLatency()-convL.getLatency());

//conv L
juce::dsp::AudioBlock<float> blockL (bufferL);
juce::dsp::ProcessContextReplacing<float> context1 (blockL);
convL.process (context1);
mixer.pushDrySamples(context1.getOutputBlock());

//conv R in the buffer
juce::dsp::AudioBlock<float> blockR (buffer);
juce::dsp::ProcessContextReplacing<float> context2 (blockR);
convR.process (context2);

//mixing both to buffer and breaking something in some plugin hosts :(
mixer.mixWetSamples(context2.getOutputBlock());