wavelength 1.0.0
Loading...
Searching...
No Matches
lfo.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/timer.h"
4
11class Lfo {
12public:
20
29 Lfo();
30
37 void Start();
38
47 void Stop();
48
58 float Tick();
59
67 float Evaluate();
68
77 float GetCycles(float fSeconds) const;
78
87 float ValueAt(float fSeconds) const;
88
90 int GetWaveform() const {
91 return mWaveform;
92 }
93
95 void SetWaveform(int nWaveform) {
96 mWaveform = nWaveform;
97 }
98
100 float GetPhase() const {
101 return mPhase;
102 }
103
105 void SetPhase(float fPhase) {
106 mPhase = fPhase;
107 }
108
110 float GetPeriod() const {
111 return mPeriod;
112 }
113
115 void SetPeriod(float fPeriod) {
116 mPeriod = fPeriod;
117 }
118
119private:
120 Timer mTimer;
121 int mWaveform;
122 float mPeriod;
123 float mPhase;
124 float mElapsedMs;
125};
Waveform
Shapes of the oscillation, the values of mWaveform.
Definition lfo.h:14
@ kWaveformSine
Definition lfo.h:15
@ kWaveformSquare
Definition lfo.h:17
@ kWaveformTriangle
Definition lfo.h:16
@ kWaveformConstant
Definition lfo.h:18
void Stop()
Stop the clock of the oscillator.
int GetWaveform() const
Definition lfo.h:90
float GetPeriod() const
Definition lfo.h:110
float ValueAt(float fSeconds) const
Report the value of the oscillation at a time.
void SetWaveform(int nWaveform)
Definition lfo.h:95
float GetPhase() const
Definition lfo.h:100
void SetPeriod(float fPeriod)
Definition lfo.h:115
float GetCycles(float fSeconds) const
Convert a time to cycles of the oscillation.
void Start()
Start the clock of the oscillator.
Lfo()
Construct a stopped sine oscillator with a period of one second.
float Tick()
Add the time since the last call to the elapsed time and restart the clock.
void SetPhase(float fPhase)
Definition lfo.h:105
float Evaluate()
Advance the clock and report the value of the oscillation.
Stopwatch on the EE cycle counter.
Definition timer.h:16