Mercurial > hg > beaglert
comparison projects/airharp/Waveguide.h @ 164:40badaff5729 heavy-updated
- added more pd/heavy examples
- removed heavy-specific flags from Makefile
- added air-harp cpp example project
author | chnrx <chris.heinrichs@gmail.com> |
---|---|
date | Thu, 03 Dec 2015 16:19:33 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
163:20b52283c7b4 | 164:40badaff5729 |
---|---|
1 /* | |
2 * | |
3 * Simple 1-Dimensional Waveguide | |
4 * | |
5 * Christian Heinrichs 04/2015 | |
6 * | |
7 */ | |
8 | |
9 #ifndef WAVEGUIDE_H_ | |
10 #define WAVEGUIDE_H_ | |
11 | |
12 #include <cmath> | |
13 | |
14 #ifndef WG_BUFFER_SIZE | |
15 #define WG_BUFFER_SIZE 4096 | |
16 #endif | |
17 | |
18 #ifndef FILTER_BUFFER_SIZE | |
19 #define FILTER_BUFFER_SIZE 4 | |
20 #endif | |
21 | |
22 #ifndef M_PI | |
23 #define M_PI 3.14159265358979323846264338 | |
24 #endif | |
25 | |
26 class Waveguide | |
27 { | |
28 | |
29 public: | |
30 | |
31 Waveguide(); | |
32 void setup(); | |
33 float update(float in); | |
34 void updateFilterCoeffs(float frequency); | |
35 void setFrequency(float frequency); | |
36 | |
37 private: | |
38 | |
39 double _dt; | |
40 float _periodInMilliseconds; | |
41 int _periodInSamples; | |
42 | |
43 float _buffer[WG_BUFFER_SIZE]; | |
44 int _readPtr; | |
45 | |
46 float _filterBuffer_x[FILTER_BUFFER_SIZE]; | |
47 float _filterBuffer_y[FILTER_BUFFER_SIZE]; | |
48 float _hipBuffer_x[FILTER_BUFFER_SIZE]; | |
49 float _hipBuffer_y[FILTER_BUFFER_SIZE]; | |
50 int _filterReadPtr; | |
51 | |
52 float b0_lp,b1_lp,b2_lp,a1_lp, a2_lp; | |
53 float _lastY,_lastX; | |
54 | |
55 }; | |
56 | |
57 #endif |