Plaquette
 
Loading...
Searching...
No Matches
TriangleWave.h
1/*
2 * TriangleWave.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 TRIANGLE_WAVE_H_
22#define TRIANGLE_WAVE_H_
23
24#include "AbstractWave.h"
25#include "pq_easing.h"
26
27namespace pq {
28
33class [[deprecated("Use Wave(TRIANGLE) instead.")]] TriangleWave : public AbstractWave {
34public:
39 TriangleWave(Engine& engine = Engine::primary());
40
46 TriangleWave(float period, Engine& engine = Engine::primary());
47
54 TriangleWave(float period, float skew, Engine& engine = Engine::primary());
55
56 virtual ~TriangleWave() {}
57
62 void riseEasing(easing_function easing) { _riseEasing = easing; }
63
65 void noRiseEasing() { riseEasing(easeNone); }
66
71 void fallEasing(easing_function easing) { _fallEasing = easing; }
72
74 void noFallEasing() { fallEasing(easeNone); }
75
80 void easing(easing_function easing) { _riseEasing = _fallEasing = easing; }
81
83 void noEasing() { easing(easeNone); }
84
85protected:
86 // Returns value in [0, 1].
87// virtual float _get(q0_32u_t t);
88 virtual q0_32u_t _getFixed32(q0_32u_t t);
89
90
91 virtual float _getAmplified(q0_32u_t t);
92
93 // Optional easing to apply on the rise and fall of the wave.
94 easing_function _riseEasing;
95 easing_function _fallEasing;
96};
97
99[[deprecated("Use Wave(TRIANGLE) instead.")]]
100typedef TriangleWave TriOsc;
101
102}
103
104#endif
Triangle/sawtooth oscillator.
Definition AbstractWave.h:33
The main Plaquette static class containing all the units.
Definition PqCore.h:60
Definition TriangleWave.h:33
void easing(easing_function easing)
Sets easing function to apply to both rise and fall of the wave.
Definition TriangleWave.h:80
void noFallEasing()
Remove easing function for wave rise.
Definition TriangleWave.h:74
void noRiseEasing()
Remove easing function for wave rise.
Definition TriangleWave.h:65
void noEasing()
Remove easing functions.
Definition TriangleWave.h:83
void fallEasing(easing_function easing)
Sets easing function to apply to wave rise.
Definition TriangleWave.h:71
void riseEasing(easing_function easing)
Sets easing function to apply to wave rise.
Definition TriangleWave.h:62