Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
FeedbackOscillator.h
1 /*
2  * FeedbackOscillator.h
3  *
4  * Created on: June 8, 2014
5  * Author: Andrew McPherson
6  */
7 
8 #ifndef FEEDBACKOSCILLATOR_H
9 #define FEEDBACKOSCILLATOR_H
10 
12 {
13 public:
16 
17  // Initialise the settings for the feedback oscillator
18  void initialise(int maxTableSize, float hpfCutoffFrequency, float matrixSampleRate);
19 
20  // Process one sample and store the output value
21  // Returns the length of table to interpolate; or 0 if nothing to process further
22  int process(float input, float *output);
23 
24  float *wavetable() { return wavetableRead; }
25 
26 private:
27  float coeffs[3]; // Coefficients of first-order high-pass filter
28  float lastInput; // last input sample for HPF
29  float lastOutput; // last output sample of HPF
30  bool triggered; // whether we are currently saving samples
31  bool canTrigger; // whether we are able to begin saving samples
32  int wavetableMaxLength; // how long the stored wavetable can be
33  int sampleCount; // how many samples have elapsed
34  int lastTriggerCount; // sample count when we last triggered
35 
36  float *wavetable1, *wavetable2; // Two wavetables where we record samples
37  float *wavetableRead, *wavetableWrite; // Pointers to the above wavetables
38  int wavetableWritePointer; // Where we are currently writing
39 };
40 
41 #endif
Definition: FeedbackOscillator.h:11