Mercurial > hg > bayesian-drum-tracker
view newOFsrc/testApp.h @ 9:0ad78ead0b75
adding output file capability
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 06 Mar 2012 17:20:18 +0000 |
parents | 525938caf772 |
children | d880f7f29fbe |
line wrap: on
line source
#ifndef _TEST_APP #define _TEST_APP #include "ofMain.h" #include "ofxOsc.h" //#include "bayesianArray.h" //#include "beatTempo.h" #include "BayesDrumTracker.h" #include <iostream> #include <fstream> // listen on port 12345 #define PORT 12345 #define NUM_MSG_STRINGS 45 #define HOST "localhost" #define ARRAY_SIZE 240//need to replace this with const int in drumtracker #define NUMBER_OF_SCREENS 8 class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void drawBayesianDistribution(); void drawTempoData(); void drawTempoDistribution(); void drawRestrictedTempoDistribution(int tmpMin, int tmpMax); void drawBeatMap(); void drawNormalisedLikelihood(); void drawBeatProbabilityDistribution(); void drawPosterior(); void printBayesianData(); void drawGreyscaleBayesianDistribution(); void drawGreyscaleTempoDistribution(double tempoInterval); void drawTempoInfo(); void resetParameters(); void takePictureOfScreen(); void crossUpdateArrays(float timeInterval); void updateTempoProcess(double cpuTime, string onsetType); void sendMaxTempo(); void sendMaxPhase(); double convertToBPM(double interval); bool filterBeatTime(double newBeatTime); // float beatIndexToMsec(int index); // float tempoIndexToMsec(int index); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); void setGaussianLikelihood(float mean, float StdDev); void setGaussianPrior(float mean, float StdDev); void calculatePosterior(); void renormalisePosterior(); float getMaximum(float *ptr, int length); void renormaliseArray(float *ptr, int length); void updateOSCmessages(); void resetPrior(); void decayPosterior(); void translateDistribution(int translationIndex); void setBeatDistribution(int beatPosition); void calculateTempoUpdate(double tempoInterval); bool updateTempoIfWithinRange(double timeInterval); float* getMaximumEstimate(float *ptr, int length); void drawTempoDataPoints(const int& tmpMin, const int& tmpMax, const float& tmpStepSize); int xcoordinateFromTempoDataPoint(float f); int xcoordinateFromRestrictedTempoDataPoint(float f, const int& tmpMin, const int& tmpMax); float arrayToMsecScaleFactor;// = (tempoMaximum - tempoMinimum)/ ARRAY_SIZE;//turns array into ms int tempoWindowMinimum, tempoWindowMaximum, tempoWindowWidth; ofTrueTypeFont font; ofxOscReceiver receiver; string msg_string, debugString, kickString; bool bSmooth; // float kickError, snareError; // float testArray[5]; // float prior [ARRAY_SIZE]; // float posterior [ARRAY_SIZE]; // float likelihood [ARRAY_SIZE]; // float likelihoodMean, likelihoodStdDev, likelihoodNoise, stepSize; // float maximumEstimate; // float maximumTest, posteriorDecayRate, maximumIndex; // float eighthNoteProportion; float stepSize; int screenWidth, screenHeight; bool printInterval, paused; bool drawData, hidePriorMode; /* bayesianArray beatDistribution; double tempoMinimum, tempoMaximum; double tempoInterval; beatTempo beatTimes; */ //double tempoInterval; float mouseBPM; // int correctBeatBy; // string tempoUpdateStrings[16]; // string tempoDataString; double KLdiv, entropy, recentError; string drumType; double priorValue; double beatPosition; void drawKLdivAndEntropy(); ofstream outputFile; private: // ofxOscSender sender; //float noiseFactor, stdDevFactor; // int minTmpDebug, maxTmpDebug; // float correctionFactor; // string onsetType; // string timeString; // double cpuBeatTime; // double cpuClockTime; int screenToDraw; // double posteriorMaximum; // bool adaptiveStandardDeviationMode; bool bSnapshot; int snapCounter; ofImage img; // double tempoStdDev; // bool accompanimentStarted; // bool setDistributionOnStartTempo; // int integerMultipleOfTatum; BayesDrumTracker drumTracker; }; #endif