我正在编写一个卷积混响插件,并想添加一个预延迟滑块。我在两个单独的缓冲区中有“干”信号和“湿”信号用于播放,如下面的代码所示:
// copy the original signal into a "dry signal" buffer that we'll use later
AudioSampleBuffer dryBuffer(buffer.getNumChannels(), buffer.getNumSamples());
// now apply convolution to the buffer
for (int i = 0; i < buffer.getNumChannels(); ++i)
{
float* writePointer = buffer.getWritePointer (i % getNumOutputChannels());
const float* readPointer = buffer.getReadPointer (i % getNumInputChannels());
dryBuffer.copyFrom(
i, // destChannel
0, //destStartSample
buffer, // sourceBuffer
i, // sourceChannel
0, // sourceStartSample,
buffer.getNumSamples()
);
convolvers.getUnchecked(i % convolvers.size())->process (readPointer, writePointer, buffer.getNumSamples());
//WET MIX
buffer.applyGain(i, // channel
0, // startSample
buffer.getNumSamples(),
wetLevel->getValue() // gain
);
//DRY MIX
dryBuffer.applyGain(i,
0,
dryBuffer.getNumSamples(),
dryLevel->getValue()
);
buffer.addFrom(
i, // destChannel
0, // destStartSample
dryBuffer, // sourceBuffer
i, // sourceChannel
0, // soucreStartSample,
buffer.getNumSamples(),
1.0 // gain
);
}
dryBuffer 是干 AudioSampleBuffer,缓冲区是应用卷积的湿信号。如何延迟湿缓冲区的播放?