CMLSDelay.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. ==============================================================================
  3. CMLSDelay.h
  4. Created: 3 May 2025 5:39:35pm
  5. Author: Luigi
  6. Ref. https://github.com/flipbug/simple-delay/tree/master
  7. ==============================================================================
  8. */
  9. #pragma once
  10. #include <JuceHeader.h>
  11. #define MAX_DELAY_LENGTH 1.0f // Maximum delay time in seconds
  12. #define MIN_FEEDBACK -100.0f
  13. #define MAX_FEEDBACK 0.0f
  14. class CMLSDelay : public juce::dsp::ProcessorBase
  15. {
  16. public:
  17. CMLSDelay();
  18. ~CMLSDelay() override;
  19. void reset() override;
  20. void prepare(const juce::dsp::ProcessSpec&) override;
  21. void process(const juce::dsp::ProcessContextReplacing<float>&) override;
  22. // Parameter getters and setters
  23. void setDryWet(float value);
  24. void setAmount(float value);
  25. const float getDryWet();
  26. const float getAmount();
  27. private:
  28. float effectDelaySamples;
  29. //Paramters
  30. float dryWetProp;
  31. float feedback;
  32. float delayLength;
  33. float amount;
  34. // Normaliosable range
  35. juce::NormalisableRange<float>* delayLengthRange;
  36. juce::NormalisableRange<float>* feedbackRange;
  37. //Delay Lines
  38. juce::dsp::DelayLine<float> delayLine;
  39. juce::dsp::DelayLine<float, juce::dsp::DelayLineInterpolationTypes::Linear> linearDelay;
  40. juce::dsp::DryWetMixer<float> mixer;
  41. std::array<float, 2> delayValue;
  42. std::array<float, 2> lastDelayOutput;
  43. std::array<juce::LinearSmoothedValue<float>, 2> delayFeedbackVolume;
  44. };