Mercurial > hg > bayesian-drum-tracker
comparison newOFsrc/testApp.h @ 2:c49a8f33afab
adding new OF source
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Wed, 22 Feb 2012 22:16:48 +0000 |
parents | |
children | 6565c7cb9c71 |
comparison
equal
deleted
inserted
replaced
1:690ec1eb8180 | 2:c49a8f33afab |
---|---|
1 #ifndef _TEST_APP | |
2 #define _TEST_APP | |
3 | |
4 | |
5 | |
6 #include "ofMain.h" | |
7 #include "ofxOsc.h" | |
8 //#include "bayesianArray.h" | |
9 //#include "beatTempo.h" | |
10 #include "BayesDrumTracker.h" | |
11 | |
12 // listen on port 12345 | |
13 #define PORT 12345 | |
14 #define NUM_MSG_STRINGS 45 | |
15 #define HOST "localhost" | |
16 #define ARRAY_SIZE 240//need to replace this with const int in drumtracker | |
17 | |
18 #define NUMBER_OF_SCREENS 8 | |
19 | |
20 class testApp : public ofBaseApp{ | |
21 | |
22 public: | |
23 | |
24 void setup(); | |
25 void update(); | |
26 void draw(); | |
27 void drawBayesianDistribution(); | |
28 void drawTempoData(); | |
29 void drawTempoDistribution(); | |
30 void drawRestrictedTempoDistribution(int tmpMin, int tmpMax); | |
31 | |
32 void drawBeatMap(); | |
33 void drawNormalisedLikelihood(); | |
34 void drawBeatProbabilityDistribution(); | |
35 void drawPosterior(); | |
36 void printBayesianData(); | |
37 void drawGreyscaleBayesianDistribution(); | |
38 void drawGreyscaleTempoDistribution(double tempoInterval); | |
39 void drawTempoInfo(); | |
40 | |
41 void resetParameters(); | |
42 void takePictureOfScreen(); | |
43 | |
44 void crossUpdateArrays(float timeInterval); | |
45 void updateTempoProcess(double cpuTime, string onsetType); | |
46 | |
47 void sendMaxTempo(); | |
48 void sendMaxPhase(); | |
49 double convertToBPM(double interval); | |
50 bool filterBeatTime(double newBeatTime); | |
51 | |
52 // float beatIndexToMsec(int index); | |
53 // float tempoIndexToMsec(int index); | |
54 | |
55 void keyPressed(int key); | |
56 void keyReleased(int key); | |
57 void mouseMoved(int x, int y ); | |
58 void mouseDragged(int x, int y, int button); | |
59 void mousePressed(int x, int y, int button); | |
60 void mouseReleased(int x, int y, int button); | |
61 void windowResized(int w, int h); | |
62 | |
63 void setGaussianLikelihood(float mean, float StdDev); | |
64 void setGaussianPrior(float mean, float StdDev); | |
65 void calculatePosterior(); | |
66 void renormalisePosterior(); | |
67 float getMaximum(float *ptr, int length); | |
68 void renormaliseArray(float *ptr, int length); | |
69 void updateOSCmessages(); | |
70 void resetPrior(); | |
71 void decayPosterior(); | |
72 void translateDistribution(int translationIndex); | |
73 void setBeatDistribution(int beatPosition); | |
74 void calculateTempoUpdate(double tempoInterval); | |
75 bool updateTempoIfWithinRange(double timeInterval); | |
76 | |
77 float* getMaximumEstimate(float *ptr, int length); | |
78 void drawTempoDataPoints(const int& tmpMin, const int& tmpMax, const float& tmpStepSize); | |
79 int xcoordinateFromTempoDataPoint(float f); | |
80 int xcoordinateFromRestrictedTempoDataPoint(float f, const int& tmpMin, const int& tmpMax); | |
81 | |
82 float arrayToMsecScaleFactor;// = (tempoMaximum - tempoMinimum)/ ARRAY_SIZE;//turns array into ms | |
83 | |
84 | |
85 | |
86 int tempoWindowMinimum, tempoWindowMaximum, tempoWindowWidth; | |
87 | |
88 ofTrueTypeFont font; | |
89 | |
90 ofxOscReceiver receiver; | |
91 string msg_string, debugString, kickString; | |
92 | |
93 bool bSmooth; | |
94 // float kickError, snareError; | |
95 // float testArray[5]; | |
96 | |
97 // float prior [ARRAY_SIZE]; | |
98 // float posterior [ARRAY_SIZE]; | |
99 // float likelihood [ARRAY_SIZE]; | |
100 // float likelihoodMean, likelihoodStdDev, likelihoodNoise, stepSize; | |
101 // float maximumEstimate; | |
102 // float maximumTest, posteriorDecayRate, maximumIndex; | |
103 // float eighthNoteProportion; | |
104 | |
105 float stepSize; | |
106 int screenWidth, screenHeight; | |
107 | |
108 bool printInterval, paused; | |
109 bool drawData, hidePriorMode; | |
110 | |
111 | |
112 /* | |
113 bayesianArray beatDistribution; | |
114 | |
115 double tempoMinimum, tempoMaximum; | |
116 double tempoInterval; | |
117 beatTempo beatTimes; | |
118 */ | |
119 //double tempoInterval; | |
120 float mouseBPM; | |
121 // int correctBeatBy; | |
122 // string tempoUpdateStrings[16]; | |
123 // string tempoDataString; | |
124 | |
125 double KLdiv; | |
126 private: | |
127 | |
128 // ofxOscSender sender; | |
129 | |
130 //float noiseFactor, stdDevFactor; | |
131 // int minTmpDebug, maxTmpDebug; | |
132 | |
133 // float correctionFactor; | |
134 | |
135 | |
136 | |
137 // string onsetType; | |
138 // string timeString; | |
139 // double cpuBeatTime; | |
140 | |
141 // double cpuClockTime; | |
142 int screenToDraw; | |
143 // double posteriorMaximum; | |
144 // bool adaptiveStandardDeviationMode; | |
145 | |
146 bool bSnapshot; | |
147 int snapCounter; | |
148 ofImage img; | |
149 | |
150 // double tempoStdDev; | |
151 // bool accompanimentStarted; | |
152 // bool setDistributionOnStartTempo; | |
153 // int integerMultipleOfTatum; | |
154 | |
155 BayesDrumTracker drumTracker; | |
156 | |
157 }; | |
158 | |
159 #endif | |
160 |