Plaquette
 
Loading...
Searching...
No Matches
Wave.h
1/*
2 * Wave.h
3 *
4 * (c) 2015 Sofian Audry :: info(@)sofianaudry(.)com
5 * (c) 2015 Thomas O Fredericks :: tof(@)t-o-f(.)info
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef WAVE_H_
22#define WAVE_H_
23
24#include "AbstractWave.h"
25
26namespace pq
27{
28
29enum WaveShape {
30 SQUARE,
31 TRIANGLE,
32 SINE,
33 N_SHAPES
34};
35
37class Wave : public AbstractWave
38{
39public:
46
52 explicit Wave(WaveShape shape, Engine &engine = Engine::primary());
53
60 Wave(float period, float skew, Engine &engine = Engine::primary());
61
68 Wave(WaveShape shape, float period, Engine &engine = Engine::primary());
69
77 Wave(WaveShape shape, float period, float skew, Engine &engine = Engine::primary());
78
79 virtual ~Wave() {}
80
85 void shape(WaveShape shape);
86
88 WaveShape shape() const { return _shape; }
89
90protected:
91 // Returns value in [0, 1].
92 // virtual float _get(q0_32u_t t);
93 virtual q0_32u_t _getFixed32(q0_32u_t t);
94
95private:
96 WaveShape _shape;
97};
98
99}
100
101#endif
virtual float period() const
Returns the period (in seconds).
Definition AbstractOscillator.h:50
Triangle/sawtooth oscillator.
Definition AbstractWave.h:33
virtual float skew() const
Returns the skew of the signal.
Definition AbstractWave.h:103
The main Plaquette static class containing all the units.
Definition PqCore.h:60
static Engine & primary()
Returns the main instance of Plaquette.
Definition PqCore.cpp:31
Engine * engine() const
Returns the engine that owns this unit.
Definition PqCore.h:382
Sine oscillator. Phase is expressed as % of period.
Definition Wave.h:38
WaveShape shape() const
Returns current wave shape.
Definition Wave.h:88