andrew@0
|
1 #ifndef _TEST_APP
|
andrew@0
|
2 #define _TEST_APP
|
andrew@0
|
3
|
andrew@0
|
4
|
andrew@0
|
5 #include "ofMain.h"
|
andrew@0
|
6
|
andrew@0
|
7 #include "OnsetDetectionFunction.h"
|
andrew@0
|
8 #include "PeakProcessor.h"
|
andrew@0
|
9 #include "PreciseOnsetLocator.h"
|
andrew@0
|
10
|
andrew@0
|
11 class testApp : public ofBaseApp{
|
andrew@0
|
12
|
andrew@0
|
13 public:
|
andrew@0
|
14
|
andrew@0
|
15 void setup();
|
andrew@0
|
16 void update();
|
andrew@0
|
17 void draw();
|
andrew@0
|
18
|
andrew@0
|
19 void keyPressed(int key);
|
andrew@0
|
20 void keyReleased(int key);
|
andrew@0
|
21 void mouseMoved(int x, int y );
|
andrew@0
|
22 void mouseDragged(int x, int y, int button);
|
andrew@0
|
23 void mousePressed(int x, int y, int button);
|
andrew@0
|
24 void mouseReleased(int x, int y, int button);
|
andrew@0
|
25 void windowResized(int w, int h);
|
andrew@0
|
26 void dragEvent(ofDragInfo dragInfo);
|
andrew@0
|
27 void gotMessage(ofMessage msg);
|
andrew@0
|
28
|
andrew@0
|
29 void audioIn(float * input, int bufferSize, int nChannels);
|
andrew@0
|
30
|
andrew@0
|
31 vector <float> left;
|
andrew@0
|
32 vector <float> right;
|
andrew@0
|
33 vector <float> volHistory;
|
andrew@0
|
34
|
andrew@0
|
35 int bufferCounter;
|
andrew@0
|
36 int drawCounter;
|
andrew@0
|
37
|
andrew@0
|
38 float smoothedVol;
|
andrew@0
|
39 float scaledVol;
|
andrew@0
|
40
|
andrew@0
|
41 ofSoundStream soundStream;
|
andrew@0
|
42
|
andrew@0
|
43 OnsetDetectionFunction odf;
|
andrew@0
|
44
|
andrew@0
|
45 PeakProcessor peakProcess;
|
andrew@0
|
46
|
andrew@0
|
47 PreciseOnsetLocator precisionLocator;
|
andrew@0
|
48
|
andrew@0
|
49 bool holdOn;
|
andrew@0
|
50 int bufferSize;
|
andrew@0
|
51 int exactOnsetIndex;
|
andrew@0
|
52 vector <double> onsetSamples;//holds the audio samples when onset is found
|
andrew@0
|
53 // vector <double> recentBufferSamples;
|
andrew@0
|
54
|
andrew@0
|
55 /*
|
andrew@0
|
56 //peak processing requires
|
andrew@0
|
57 static const int vectorSize = 512/6;
|
andrew@0
|
58 vector<double> recentDFsamples;
|
andrew@0
|
59 vector<bool> recentDFonsetFound;
|
andrew@0
|
60 vector<double> recentDFslopeValues;
|
andrew@0
|
61
|
andrew@0
|
62 int numberOfDetectionValuesToTest;
|
andrew@0
|
63 bool peakProcessing(const double& newDFval);
|
andrew@0
|
64 double getBestSlopeValue(const float& dfvalue);
|
andrew@0
|
65 bool checkForSlopeOnset(const float& bestValue);
|
andrew@0
|
66 int currentFrame, lastSlopeOnsetFrame, cutoffForRepeatOnsetsFrames;
|
andrew@0
|
67 void updateDetectionTriggerThreshold(const float& val);
|
andrew@0
|
68 float detectionTriggerThreshold, detectionTriggerRatio;
|
andrew@0
|
69 float bestSlopeMedian, thresholdRelativeToMedian;
|
andrew@0
|
70 bool newOnsetFound, slopeFallenBelowMedian;
|
andrew@0
|
71 */
|
andrew@0
|
72 /*
|
andrew@0
|
73
|
andrew@0
|
74
|
andrew@0
|
75
|
andrew@0
|
76 double getLastEnergySum(const int& startIndex, const int& vectorSize);
|
andrew@0
|
77 int findExactOnset();
|
andrew@0
|
78
|
andrew@0
|
79 */
|
andrew@0
|
80 };
|
andrew@0
|
81
|
andrew@0
|
82
|
andrew@0
|
83 #endif
|
andrew@0
|
84
|