comparison aubioOnsetDetectorOFvisualiser/src/testApp.h @ 3:979125db34ab

added OF visualiser src code. Added a long term median trigger threshold. New method is working very well on onsets
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Mon, 21 Nov 2011 23:22:40 +0000
parents
children
comparison
equal deleted inserted replaced
2:b4c899822b4e 3:979125db34ab
1 #ifndef _TEST_APP
2 #define _TEST_APP
3
4
5 #include "ofMain.h"
6
7 #include "ofxOsc.h"
8
9 // listen on port 12345
10 #define PORT 12345
11 #define NUM_MSG_STRINGS 20
12 #define NUM_DETECTION_SAMPLES 128000
13
14 //--------------------------------------------------------
15 class testApp : public ofBaseApp{
16
17 public:
18
19 void setup();
20 void update();
21 void draw();
22
23 void keyPressed (int key);
24 void mouseMoved(int x, int y );
25 void mouseDragged(int x, int y, int button);
26 void mousePressed(int x, int y, int button);
27 void mouseReleased(int x, int y, int button);
28 void windowResized(int w, int h);
29
30 void printMessages();
31 void printInfo();
32
33
34 void checkMaxima(float f);
35 void checkRawMaxima(float f);
36
37 void drawOnsetFunction();
38 ofTrueTypeFont font;
39
40
41
42 private:
43 ofxOscReceiver receiver;
44
45 int current_msg_string;
46
47 //aubio onset detection
48 float onsetFunction[NUM_DETECTION_SAMPLES];
49 int onsetIndex;
50 bool onsetRecorded[NUM_DETECTION_SAMPLES];
51
52 //specDiffOnset2~ detection
53 int rawOnsetIndex;
54 float rawOnsetFunction[NUM_DETECTION_SAMPLES];
55 bool rawOnsetRecorded[NUM_DETECTION_SAMPLES];
56
57 //median of the detection function
58 int medianOnsetIndex;
59 float medianOnsetFunction[NUM_DETECTION_SAMPLES];
60 bool medianOnsetRecorded[NUM_DETECTION_SAMPLES];
61
62
63 float maximumDetectionFunction;
64 float minimumDetectionFunction;
65
66 float maxValue;
67
68 int amplitudeNumber;
69 bool outputGraphics;
70 bool resetMaxima;
71
72 string msg_strings[NUM_MSG_STRINGS];
73 float timers[NUM_MSG_STRINGS];
74 string detectionType;
75 float lastOnsetDetectionValue;
76 int mouseX, mouseY;
77 string mouseButtonState;
78
79 string axisString[128];
80
81 bool reIndexFlag;
82 bool logMode;
83 bool midiMode;
84
85 float screenWidth;
86 float screenHeight;
87
88
89 string midiString[128];
90
91 int mouseDownX;
92 int mouseDownY;
93
94 float freqMin ;
95 float freqMax ;
96 float freqLog ;
97 float logMin ;
98 };
99
100 #endif