Mercurial > hg > beaglert
view examples/airharp/Waveguide.h @ 424:9614e2f4b76e prerelease
Makefile now supports a QUIET flag which silences some of the outputs (currently only the one from STOP). QUIET is enabled by default for runide (or any of the QUIET_TARGETS). Added target for stop to runide
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Thu, 16 Jun 2016 14:34:18 +0100 |
parents | dbeed520b014 |
children |
line wrap: on
line source
/* * * Simple 1-Dimensional Waveguide * * Christian Heinrichs 04/2015 * */ #ifndef WAVEGUIDE_H_ #define WAVEGUIDE_H_ #include <cmath> #ifndef WG_BUFFER_SIZE #define WG_BUFFER_SIZE 4096 #endif #ifndef FILTER_BUFFER_SIZE #define FILTER_BUFFER_SIZE 4 #endif #ifndef M_PI #define M_PI 3.14159265358979323846264338 #endif class Waveguide { public: Waveguide(); void setup(); float update(float in); void updateFilterCoeffs(float frequency); void setFrequency(float frequency); private: double _dt; float _periodInMilliseconds; int _periodInSamples; float _buffer[WG_BUFFER_SIZE]; int _readPtr; float _filterBuffer_x[FILTER_BUFFER_SIZE]; float _filterBuffer_y[FILTER_BUFFER_SIZE]; float _hipBuffer_x[FILTER_BUFFER_SIZE]; float _hipBuffer_y[FILTER_BUFFER_SIZE]; int _filterReadPtr; float b0_lp,b1_lp,b2_lp,a1_lp, a2_lp; float _lastY,_lastX; }; #endif