andrew@3: #ifndef _TEST_APP andrew@3: #define _TEST_APP andrew@3: andrew@3: andrew@3: #include "ofMain.h" andrew@3: andrew@3: #include "ofxOsc.h" andrew@3: andrew@3: // listen on port 12345 andrew@3: #define PORT 12345 andrew@3: #define NUM_MSG_STRINGS 20 andrew@3: #define NUM_DETECTION_SAMPLES 128000 andrew@3: andrew@3: //-------------------------------------------------------- andrew@3: class testApp : public ofBaseApp{ andrew@3: andrew@3: public: andrew@3: andrew@3: void setup(); andrew@3: void update(); andrew@3: void draw(); andrew@3: andrew@3: void keyPressed (int key); andrew@3: void mouseMoved(int x, int y ); andrew@3: void mouseDragged(int x, int y, int button); andrew@3: void mousePressed(int x, int y, int button); andrew@3: void mouseReleased(int x, int y, int button); andrew@3: void windowResized(int w, int h); andrew@3: andrew@3: void printMessages(); andrew@3: void printInfo(); andrew@3: andrew@3: andrew@3: void checkMaxima(float f); andrew@3: void checkRawMaxima(float f); andrew@3: andrew@3: void drawOnsetFunction(); andrew@3: ofTrueTypeFont font; andrew@3: andrew@3: andrew@3: andrew@3: private: andrew@3: ofxOscReceiver receiver; andrew@3: andrew@3: int current_msg_string; andrew@3: andrew@3: //aubio onset detection andrew@3: float onsetFunction[NUM_DETECTION_SAMPLES]; andrew@3: int onsetIndex; andrew@3: bool onsetRecorded[NUM_DETECTION_SAMPLES]; andrew@3: andrew@3: //specDiffOnset2~ detection andrew@3: int rawOnsetIndex; andrew@3: float rawOnsetFunction[NUM_DETECTION_SAMPLES]; andrew@3: bool rawOnsetRecorded[NUM_DETECTION_SAMPLES]; andrew@3: andrew@3: //median of the detection function andrew@3: int medianOnsetIndex; andrew@3: float medianOnsetFunction[NUM_DETECTION_SAMPLES]; andrew@3: bool medianOnsetRecorded[NUM_DETECTION_SAMPLES]; andrew@3: andrew@3: andrew@3: float maximumDetectionFunction; andrew@3: float minimumDetectionFunction; andrew@3: andrew@3: float maxValue; andrew@3: andrew@3: int amplitudeNumber; andrew@3: bool outputGraphics; andrew@3: bool resetMaxima; andrew@3: andrew@3: string msg_strings[NUM_MSG_STRINGS]; andrew@3: float timers[NUM_MSG_STRINGS]; andrew@3: string detectionType; andrew@3: float lastOnsetDetectionValue; andrew@3: int mouseX, mouseY; andrew@3: string mouseButtonState; andrew@3: andrew@3: string axisString[128]; andrew@3: andrew@3: bool reIndexFlag; andrew@3: bool logMode; andrew@3: bool midiMode; andrew@3: andrew@3: float screenWidth; andrew@3: float screenHeight; andrew@3: andrew@3: andrew@3: string midiString[128]; andrew@3: andrew@3: int mouseDownX; andrew@3: int mouseDownY; andrew@3: andrew@3: float freqMin ; andrew@3: float freqMax ; andrew@3: float freqLog ; andrew@3: float logMin ; andrew@3: }; andrew@3: andrew@3: #endif