Skip to content

File flanger.h

File List > DaisySP > Source > Effects > flanger.h

Go to the documentation of this file

Source Code

/*
Copyright (c) 2020 Electrosmith, Corp

Use of this source code is governed by an MIT-style
license that can be found in the LICENSE file or at
https://opensource.org/licenses/MIT.
*/

#pragma once
#ifndef DSY_FLANGER_H
#define DSY_FLANGER_H
#ifdef __cplusplus

#include <stdint.h>
#include "Utility/delayline.h"

namespace daisysp
{
class Flanger
{
  public:
    void Init(float sample_rate);

    float Process(float in);

    void SetFeedback(float feedback);

    void SetLfoDepth(float depth);

    void SetLfoFreq(float freq);

    void SetDelay(float delay);

    void SetDelayMs(float ms);

  private:
    float                    sample_rate_;
    static constexpr int32_t kDelayLength = 960; // 20 ms at 48kHz = .02 * 48000

    float feedback_;

    //triangle lfos
    float lfo_phase_;
    float lfo_freq_;
    float lfo_amp_;

    float delay_;

    DelayLine<float, kDelayLength> del_;

    float ProcessLfo();
};
} //namespace daisysp
#endif
#endif