1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

DSP: Solved an issue with dsp::Convolution algorithm initialisation

This commit is contained in:
hogliux 2018-06-29 10:02:33 +01:00
parent 071af1c285
commit 544e35655a

View file

@ -377,6 +377,16 @@ struct Convolution::Pimpl : private Thread
stopThread (10000);
}
//==============================================================================
/** Inits the size of the interpolation buffer. */
void initProcessing (int maximumBufferSize)
{
stopThread (1000);
interpolationBuffer.setSize (1, maximumBufferSize, false, false, true);
mustInterpolate = false;
}
//==============================================================================
/** Adds a new change request. */
void addToFifo (ChangeRequest type, juce::var parameter)
@ -659,8 +669,6 @@ struct Convolution::Pimpl : private Thread
// action depending on the change level
if (changeLevel == 3)
{
interpolationBuffer.setSize (2, static_cast<int> (currentInfo.maximumBufferSize), false, false, true);
loadImpulseResponse();
processImpulseResponse();
initializeConvolutionEngines();
@ -717,16 +725,16 @@ struct Convolution::Pimpl : private Thread
{
auto&& buffer = output.getSingleChannelBlock (channel);
interpolationBuffer.copyFrom ((int) channel, 0, input.getChannelPointer (channel), (int) numSamples);
interpolationBuffer.copyFrom (0, 0, input.getChannelPointer (channel), (int) numSamples);
engines[(int) channel]->processSamples (input.getChannelPointer (channel), buffer.getChannelPointer (0), numSamples);
changeVolumes[channel].applyGain (buffer.getChannelPointer (0), (int) numSamples);
auto* interPtr = interpolationBuffer.getWritePointer ((int) channel);
auto* interPtr = interpolationBuffer.getWritePointer (0);
engines[(int) channel + 2]->processSamples (interPtr, interPtr, numSamples);
changeVolumes[channel + 2].applyGain (interPtr, (int) numSamples);
buffer += interpolated.getSingleChannelBlock (channel);
buffer += interpolated;
}
if (input.getNumChannels() > 1 && currentInfo.wantsStereo == false)
@ -1154,6 +1162,7 @@ void Convolution::prepare (const ProcessSpec& spec)
juce::var (static_cast<int> (spec.maximumBlockSize)) };
pimpl->addToFifo (types, parameters, 2);
pimpl->initProcessing (static_cast<int> (spec.maximumBlockSize));
for (size_t channel = 0; channel < spec.numChannels; ++channel)
{