comparison examples/10-Instruments/airharp/Junction.h @ 464:8fcfbfb32aa0 prerelease

Examples reorder with subdirectories. Added header to each project. Moved Doxygen to bottom of render.cpp.
author Robert Jack <robert.h.jack@gmail.com>
date Mon, 20 Jun 2016 16:20:38 +0100
parents
children
comparison
equal deleted inserted replaced
463:c47709e8b5c9 464:8fcfbfb32aa0
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