Skip to content

Commit

Permalink
Fix Delay plugin when delay time is 0.0 seconds.
Browse files Browse the repository at this point in the history
  • Loading branch information
psobot committed Jan 25, 2022
1 parent 85a607f commit bc98109
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pedalboard/plugins/Delay.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Delay : public JucePlugin<juce::dsp::DelayLine<SampleType, juce::dsp::Dela
this->lastSpec = spec;
}

this->getDSP().setDelay((int)(getDelaySeconds() * spec.sampleRate));
this->getDSP().setDelay((int)(delaySeconds * spec.sampleRate));
}

virtual void reset() override { this->getDSP().reset(); }
Expand All @@ -65,7 +65,13 @@ class Delay : public JucePlugin<juce::dsp::DelayLine<SampleType, juce::dsp::Dela
SampleType dryVolume = 1.0f - getMix();
SampleType wetVolume = getMix();

this->getDSP().setDelay((int)(getDelaySeconds() * this->lastSpec.sampleRate));
if (delaySeconds == 0.0f) {
// Special case where DelayLine doesn't do anything for us.
// Regardless of the mix or feedback parameters, the input will sound identical.
return context.getInputBlock().getNumSamples();
}

this->getDSP().setDelay((int)(delaySeconds * this->lastSpec.sampleRate));

// Pass samples through the delay line with feedback:
for (size_t c = 0; c < context.getInputBlock().getNumChannels(); c++) {
Expand Down

0 comments on commit bc98109

Please sign in to comment.