Skip to content

File mode.h

File List > DaisySP > DaisySP-LGPL > Source > Filters > mode.h

Go to the documentation of this file

Source Code

/*
Copyright (c) 2023 Electrosmith, Corp, Francois Blanc, Steven Yi, Paul Batchelor

Use of this source code is governed by the LGPL V2.1
license that can be found in the LICENSE file or at
https://opensource.org/license/lgpl-2-1/
*/

#pragma once
#ifndef DAISY_MODE
#define DAISY_MODE

namespace daisysp
{
class Mode
{
  public:
    Mode() {}
    ~Mode() {}
    void Init(float sample_rate);

    float Process(float in);

    void Clear();

    inline void SetFreq(float freq) { freq_ = freq; }
    inline void SetQ(float q) { q_ = q; }

  private:
    float freq_, q_;
    float xnm1_, ynm1_, ynm2_, a0_, a1_, a2_;
    float d_, lfq_, lq_, sr_;
};
} // namespace daisysp

#endif