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

Convolution: Compensate for volume changes when resampling IRs

When normalisation is disabled, the Convolution will now adjust the gain
of the IR using the ratio of the source and destination sampling rates.
This should keep the output level constant when the Convolution's
sampling rate is changed.
This commit is contained in:
reuk 2021-03-05 19:00:23 +00:00
parent 85899f825d
commit 68d30f9c8d
2 changed files with 7 additions and 2 deletions

View file

@ -514,6 +514,9 @@ public:
AudioBuffer<float> result (original.getNumChannels(), finalSize);
resamplingSource.getNextAudioBlock ({ &result, 0, result.getNumSamples() });
result.applyGain ((float) resampleRatio);
return result;
}();
@ -550,10 +553,10 @@ public:
const auto ramp = makeRamp (static_cast<int> (spec.maximumBlockSize) * 8);
using BlockSize = decltype (spec.maximumBlockSize);
for (auto latency : { /*static_cast<BlockSize> (0),
for (auto latency : { static_cast<BlockSize> (0),
spec.maximumBlockSize / 3,
spec.maximumBlockSize,
spec.maximumBlockSize * 2, */
spec.maximumBlockSize * 2,
static_cast<BlockSize> (spec.maximumBlockSize * 2.5) })
{
testConvolution (spec,