Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
Junction.h
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
Definition: Junction.h:22