DaisySP
Loading...
Searching...
No Matches
phasor.h
1/*
2Copyright (c) 2020 Electrosmith, Corp
3
4Use of this source code is governed by an MIT-style
5license that can be found in the LICENSE file or at
6https://opensource.org/licenses/MIT.
7*/
8
9#pragma once
10#ifndef DSY_PHASOR_H
11#define DSY_PHASOR_H
12#ifdef __cplusplus
13
14namespace daisysp
15{
22class Phasor
23{
24 public:
25 Phasor() {}
26 ~Phasor() {}
34 inline void Init(float sample_rate, float freq, float initial_phase)
35 {
36 sample_rate_ = sample_rate;
37 phs_ = initial_phase;
38 SetFreq(freq);
39 }
40
43 inline void Init(float sample_rate, float freq)
44 {
45 Init(sample_rate, freq, 0.0f);
46 }
47
50 inline void Init(float sample_rate) { Init(sample_rate, 1.0f, 0.0f); }
53 float Process();
54
55
58 void SetFreq(float freq);
59
60
63 inline float GetFreq() { return freq_; }
64
65 private:
66 float freq_;
67 float sample_rate_, inc_, phs_;
68};
69} // namespace daisysp
70#endif
71#endif
Definition phasor.h:23
float Process()
Definition phasor.cpp:13
void SetFreq(float freq)
Definition phasor.cpp:7
void Init(float sample_rate)
Definition phasor.h:50
void Init(float sample_rate, float freq)
Definition phasor.h:43
void Init(float sample_rate, float freq, float initial_phase)
Definition phasor.h:34
float GetFreq()
Definition phasor.h:63
FIR Filter implementation, generic and ARM CMSIS DSP based.
Definition adenv.h:16