comparison examples/d-box/FeedbackOscillator.h @ 300:dbeed520b014 prerelease

Renamed projects to examples
author Giulio Moro <giuliomoro@yahoo.it>
date Fri, 27 May 2016 13:58:20 +0100
parents projects/d-box/FeedbackOscillator.h@be427da6fb9c
children
comparison
equal deleted inserted replaced
297:a3d83ebdf49b 300:dbeed520b014
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
11 class FeedbackOscillator
12 {
13 public:
14 FeedbackOscillator();
15 ~FeedbackOscillator();
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