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!