This project is a simple VST3 delay effect that works separately on the left and right channel. You can use different delay time on left and right channel, which can be also synchronized to tempo of the song by setting rhythmic division. There is also a bunch of additional effect like tap echo or flanger.
To achieve a delayed effect I used the circular buffer structure which size depends on from the parameters set by the user.
void DelayAudioProcessor::getStateInformation (juce::MemoryBlock& destData)
{
auto state = treeState.copyState();
std::unique_ptr<juce::XmlElement> xml(state.createXml());
copyXmlToBinary(*xml, destData);
}
void DelayAudioProcessor::setStateInformation (const void* data, int sizeInBytes)
{
std::unique_ptr<juce::XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
if (xmlState.get() != nullptr)
if (xmlState->hasTagName(treeState.state.getType()))
treeState.replaceState(juce::ValueTree::fromXml(*xmlState));
}
void DelayAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
{
lastSampleRate = sampleRate;
mCirclarBufferLenght = MAX_DELAY_TIME * sampleRate;
if (mCircularBufferLeft == nullptr)
{
mCircularBufferLeft = new float[mCirclarBufferLenght];
}
juce::zeromem(mCircularBufferLeft, mCirclarBufferLenght * sizeof(float));
if (mCircularBufferRight == nullptr)
{
mCircularBufferRight = new float[mCirclarBufferLenght];
}
juce::zeromem(mCircularBufferRight, mCirclarBufferLenght * sizeof(float));
mCircularBufferWriterHead = 0;
mCircularBufferWriterHeadLeft = 0;
mDelaySmoothed = *treeState.getRawParameterValue(TIME_R_ID);
mDelaySmoothedLeft = *treeState.getRawParameterValue(TIME_L_ID);
}
Distributed under the MIT License.