annotate examples/10-Instruments/airharp/Junction.h @ 556:ce391098f321 prerelease tip

THIS PROJECT HAS MOVED TO https://github.com/BelaPlatform/bela
author Giulio Moro <giuliomoro@yahoo.it>
date Sat, 25 Jun 2016 20:21:00 +0100
parents 8fcfbfb32aa0
children
rev   line source
robert@464 1 /*
robert@464 2 *
robert@464 3 * Excitation Junction for two waveguides
robert@464 4 *
robert@464 5 * Christian Heinrichs 04/2015
robert@464 6 *
robert@464 7 */
robert@464 8
robert@464 9 #ifndef JUNCTION_H_
robert@464 10 #define JUNCTION_H_
robert@464 11
robert@464 12 #include <cmath>
robert@464 13
robert@464 14 #ifndef WG_BUFFER_SIZE
robert@464 15 #define WG_BUFFER_SIZE 4096
robert@464 16 #endif
robert@464 17
robert@464 18 #ifndef M_PI
robert@464 19 #define M_PI 3.14159265358979323846264338
robert@464 20 #endif
robert@464 21
robert@464 22 class Junction
robert@464 23 {
robert@464 24
robert@464 25 public:
robert@464 26
robert@464 27 Junction();
robert@464 28 void setup();
robert@464 29 void update(float excitation, float left, float right);
robert@464 30 float getOutput(int direction);
robert@464 31 float getExcitationDisplacement();
robert@464 32 void setFrequency(float frequency);
robert@464 33 void setPeriod(float periodInMs);
robert@464 34 void setPluckPosition(float pluckPos);
robert@464 35
robert@464 36 private:
robert@464 37
robert@464 38 double _dt;
robert@464 39 float _periodInMilliseconds;
robert@464 40 int _periodInSamples;
robert@464 41
robert@464 42 int _delay_l;
robert@464 43 int _delay_r;
robert@464 44
robert@464 45 float _buffer_l[WG_BUFFER_SIZE];
robert@464 46 float _buffer_r[WG_BUFFER_SIZE];
robert@464 47 int _readPtr;
robert@464 48
robert@464 49 float _excitation;
robert@464 50 float _lastPlectrumDisplacement;
robert@464 51
robert@464 52 };
robert@464 53
robert@464 54 #endif