Skip to content

File metro.h

File List > DaisySP > Source > Utility > metro.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_METRO_H
#define DSY_METRO_H
#include <stdint.h>
#ifdef __cplusplus

namespace daisysp
{
class Metro
{
  public:
    Metro() {}
    ~Metro() {}
    void Init(float freq, float sample_rate);

    uint8_t Process();

    inline void Reset() { phs_ = 0.0f; }
    void SetFreq(float freq);

    inline float GetFreq() { return freq_; }

  private:
    float freq_;
    float phs_, sample_rate_, phs_inc_;
};
} // namespace daisysp
#endif
#endif