comparison projects/airharp/Junction.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 * Excitation Junction for two waveguides
4 *
5 * Christian Heinrichs 04/2015
6 *
7 */
8
9 #ifndef JUNCTION_H_
10 #define JUNCTION_H_
11
12 #include <cmath>
13
14 #ifndef WG_BUFFER_SIZE
15 #define WG_BUFFER_SIZE 4096
16 #endif
17
18 #ifndef M_PI
19 #define M_PI 3.14159265358979323846264338
20 #endif
21
22 class Junction
23 {
24
25 public:
26
27 Junction();
28 void setup();
29 void update(float excitation, float left, float right);
30 float getOutput(int direction);
31 float getExcitationDisplacement();
32 void setFrequency(float frequency);
33 void setPeriod(float periodInMs);
34 void setPluckPosition(float pluckPos);
35
36 private:
37
38 double _dt;
39 float _periodInMilliseconds;
40 int _periodInSamples;
41
42 int _delay_l;
43 int _delay_r;
44
45 float _buffer_l[WG_BUFFER_SIZE];
46 float _buffer_r[WG_BUFFER_SIZE];
47 int _readPtr;
48
49 float _excitation;
50 float _lastPlectrumDisplacement;
51
52 };
53
54 #endif