I’m trying to implement the DelayLine class in the DSP module, I would like to modulate the delay time in order to play with some various dsp effects. Would someone mind taking a look at this and showing me the error of my ways!
Here’s how I constructed it in my processor.h
juce::dsp::DelayLine<float, juce::dsp::DelayLineInterpolationTypes::Linear> mDelayLine;
This is my prepare to play function!
juce::dsp::ProcessSpec spec;
spec.sampleRate = sampleRate;
spec.maximumBlockSize = samplesPerBlock;
spec.numChannels = getTotalNumOutputChannels();
mDelayLine.reset();
mDelayLine.prepare(spec);
This is my process block!
void FeedPitchAudioProcessor::processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midiMessages)
{
juce::ScopedNoDenormals noDenormals;
auto totalNumInputChannels = getTotalNumInputChannels();
auto totalNumOutputChannels = getTotalNumOutputChannels();
// if you've got more output channels than input clears extra outputs
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
buffer.clear (i, 0, buffer.getNumSamples());
const int bufferLength = buffer.getNumSamples();
mSliderDelayTime = treeState.getRawParameterValue(DELAY_TIME_ID)->load();
for (int channel = 0; channel < totalNumInputChannels; ++channel)
{
auto* inData = buffer.getReadPointer(channel);
auto* outData = buffer.getWritePointer(channel);
for (int i = 0; i < bufferLength; i++)
{
mDelayLine.pushSample(channel, inData[i]);
outData[i] = mDelayLine.popSample(channel, mSliderDelayTime);
}
}
This is my first post on the forum so apologies if there are some rookie errors. Much appreciated! Henry.