File phasor.h¶
File List > Control > phasor.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_PHASOR_H
#define DSY_PHASOR_H
#ifdef __cplusplus
namespace daisysp
{
class Phasor
{
public:
Phasor() {}
~Phasor() {}
inline void Init(float sample_rate, float freq, float initial_phase)
{
sample_rate_ = sample_rate;
phs_ = initial_phase;
SetFreq(freq);
}
inline void Init(float sample_rate, float freq)
{
Init(sample_rate, freq, 0.0f);
}
inline void Init(float sample_rate) { Init(sample_rate, 1.0f, 0.0f); }
float Process();
void SetFreq(float freq);
inline float GetFreq() { return freq_; }
private:
float freq_;
float sample_rate_, inc_, phs_;
};
} // namespace daisysp
#endif
#endif