Skip to content

jarekkopaczewski/TwinEcho

Repository files navigation

Table of contents

About The Project

General info

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.

Product Name Screen Shot

Data structure

To achieve a delayed effect I used the circular buffer structure which size depends on from the parameters set by the user.

Product Name Screen Shot

Built With

Save parameters

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));
}

Prepare to play

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);
}

License

Distributed under the MIT License.

(back to top)

Releases

No releases published

Packages

No packages published

Languages