Mercurial > hg > beaglert
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/projects/airharp/Junction.h Thu Dec 03 16:19:33 2015 +0000 @@ -0,0 +1,54 @@ +/* + * + * Excitation Junction for two waveguides + * + * Christian Heinrichs 04/2015 + * + */ + +#ifndef JUNCTION_H_ +#define JUNCTION_H_ + +#include <cmath> + +#ifndef WG_BUFFER_SIZE +#define WG_BUFFER_SIZE 4096 +#endif + +#ifndef M_PI +#define M_PI 3.14159265358979323846264338 +#endif + +class Junction +{ + +public: + + Junction(); + void setup(); + void update(float excitation, float left, float right); + float getOutput(int direction); + float getExcitationDisplacement(); + void setFrequency(float frequency); + void setPeriod(float periodInMs); + void setPluckPosition(float pluckPos); + +private: + + double _dt; + float _periodInMilliseconds; + int _periodInSamples; + + int _delay_l; + int _delay_r; + + float _buffer_l[WG_BUFFER_SIZE]; + float _buffer_r[WG_BUFFER_SIZE]; + int _readPtr; + + float _excitation; + float _lastPlectrumDisplacement; + +}; + +#endif