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