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