andrew@43
|
1 #include "testApp.h"
|
andrew@43
|
2
|
andrew@43
|
3 //--------------------------------------------------------------
|
andrew@43
|
4 void testApp::setup(){
|
andrew@43
|
5 ofBackground(255);
|
andrew@46
|
6 histogramWidth = 10;
|
andrew@46
|
7 histogramBinNumber = 25;
|
andrew@43
|
8
|
andrew@53
|
9 ewertFlag = true;
|
andrew@48
|
10
|
andrew@49
|
11 // multiAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
|
andrew@49
|
12 // matchBackwardsAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
|
andrew@49
|
13 // matchForwardAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber);
|
andrew@49
|
14
|
andrew@49
|
15
|
andrew@49
|
16 multiAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber);
|
andrew@49
|
17 matchBackwardsAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber);
|
andrew@49
|
18 matchForwardAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber);
|
andrew@49
|
19
|
andrew@49
|
20 ewertAbsTotalHistogram.createAbsoluteHistogramForMatchData();
|
andrew@48
|
21 //processFile(0);
|
andrew@48
|
22
|
andrew@53
|
23 for (int i = 0;i < 11;i++){
|
andrew@48
|
24 processFile(i);
|
andrew@48
|
25 }
|
andrew@45
|
26
|
andrew@49
|
27 printPercentageTotals();
|
andrew@49
|
28
|
andrew@45
|
29 screenToDraw = 1;
|
andrew@45
|
30
|
andrew@49
|
31 int maxi = max(multiAbsTotalHistogram.maximum, matchForwardAbsTotalHistogram.maximum);
|
andrew@49
|
32 maxi = max(maxi, (int)matchBackwardsAbsTotalHistogram.maximum);
|
andrew@49
|
33 maxi += 10;
|
andrew@49
|
34 multiAbsTotalHistogram.maximum = maxi;
|
andrew@49
|
35 matchForwardAbsTotalHistogram.maximum = maxi;
|
andrew@49
|
36 matchBackwardsAbsTotalHistogram.maximum = maxi;
|
andrew@49
|
37
|
andrew@45
|
38
|
andrew@43
|
39 xPlotMin = 0;
|
andrew@43
|
40 xPlotMax = 40;
|
andrew@43
|
41 yPlotMin = 0;
|
andrew@43
|
42 yPlotMax = 40;
|
andrew@49
|
43
|
andrew@49
|
44 readEwertAnnotations();
|
andrew@49
|
45 }
|
andrew@49
|
46
|
andrew@49
|
47 void testApp::readEwertAnnotations(){
|
andrew@49
|
48
|
andrew@49
|
49 std::string path = "/Users/andrew/Dropbox/MultitrackAlignmentTesting/__Synchronized";
|
andrew@49
|
50 path += "/DiamondWhite_Take1__DiamondWhite_Take2.csv";
|
andrew@49
|
51 ewertReader.readInBeatsFile(path);
|
andrew@49
|
52
|
andrew@43
|
53 }
|
andrew@43
|
54
|
andrew@47
|
55
|
andrew@48
|
56 void testApp::processFile(int file){
|
andrew@48
|
57 setFilePaths(file);
|
andrew@48
|
58 readInFiles();
|
andrew@48
|
59 processResults();
|
andrew@48
|
60 }
|
andrew@48
|
61
|
andrew@47
|
62 void testApp::setFilePaths(int fileToLoad){
|
andrew@47
|
63
|
andrew@47
|
64 switch (fileToLoad) {
|
andrew@47
|
65 case 0:
|
andrew@48
|
66 liveGroundTruthPath = "../../../data/MarbleArch/marbleArch_4_beats.txt";
|
andrew@48
|
67 rehearsalGroundTruthPath = "../../../data/MarbleArch/marbleArch_6_beats.txt";
|
andrew@48
|
68 liveToRehMultitrackAlignmentPath = "../../../data/MarbleArch/MarbleArch_live4_reh6_newOutput.txt";
|
andrew@48
|
69 liveToRehMatchOFpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OF.out";
|
andrew@48
|
70 liveToRehMatchOBpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OB.out";
|
andrew@49
|
71 ewertReader.swapOrder = false;
|
andrew@49
|
72 ewertAlignmentPath = "../../../data/EwertResults/MarbleArch_Take4_multiMix__MarbleArch_Take6_multiMix.csv";
|
andrew@53
|
73 ewertFlag = true;
|
andrew@47
|
74 break;
|
andrew@50
|
75
|
andrew@47
|
76 case 1:
|
andrew@47
|
77 liveGroundTruthPath = "../../../data/Lewes/LewesTake14_beatsSV.txt";
|
andrew@47
|
78 rehearsalGroundTruthPath = "../../../data/Lewes/Take13_proper_beatsSV.txt";
|
andrew@47
|
79 liveToRehMultitrackAlignmentPath = "../../../data/Lewes/LewesLiveTake14_rehTake13proper_output.txt";
|
andrew@47
|
80 liveToRehMatchOFpath = "../../../data/Lewes/LewesLive14_reh13p_match_OF.out";
|
andrew@47
|
81 liveToRehMatchOBpath = "../../../data/Lewes/LewesLive14_reh13p_match_OB.out";
|
andrew@49
|
82 ewertReader.swapOrder = true;
|
andrew@49
|
83 ewertAlignmentPath = "../../../data/EwertResults/Lewes_Take13_Newproper_Multimix__Lewes_Take14_Multimix.csv";
|
andrew@53
|
84 ewertFlag = true;
|
andrew@47
|
85 break;
|
andrew@48
|
86 case 2:
|
andrew@48
|
87 liveGroundTruthPath = "../../../data/Wanderlust/wanderlust_take15_svBeats.txt";
|
andrew@48
|
88 rehearsalGroundTruthPath = "../../../data/Wanderlust/wanderlust_take16_svBeats.txt";
|
andrew@48
|
89 // liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_output.txt";
|
andrew@48
|
90 // liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_2_output.txt";
|
andrew@48
|
91 liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wandelust_live15_reh16_3_output_4msonsetw_dot2like.txt";
|
andrew@48
|
92 liveToRehMatchOFpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OF.out";
|
andrew@48
|
93 liveToRehMatchOBpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OB.out";
|
andrew@49
|
94 ewertReader.swapOrder = false;
|
andrew@49
|
95 ewertAlignmentPath = "../../../data/EwertResults/Wanderlust_Take15__Wanderlust_Take16.csv";
|
andrew@53
|
96 ewertFlag = true;
|
andrew@48
|
97 break;
|
andrew@48
|
98
|
andrew@48
|
99 case 3:
|
andrew@48
|
100 //THESE NEED FIXING OF GROUTND TRUTH BEATS
|
andrew@48
|
101 liveGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take1_beats.txt";
|
andrew@48
|
102 rehearsalGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take2_beats.txt";
|
andrew@48
|
103 liveToRehMultitrackAlignmentPath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_new_output.txt";
|
andrew@48
|
104 liveToRehMatchOFpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OF.out";
|
andrew@48
|
105 liveToRehMatchOBpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OB.out";
|
andrew@49
|
106 ewertReader.swapOrder = false;
|
andrew@49
|
107 ewertAlignmentPath = "../../../data/EwertResults/DiamondWhite_Take1__DiamondWhite_Take2.csv";
|
andrew@53
|
108 ewertFlag = true;
|
andrew@48
|
109 break;
|
andrew@48
|
110
|
andrew@48
|
111 case 4:
|
andrew@48
|
112 //THESE NEED FIXING OF GROUTND TRUTH BEATS
|
andrew@48
|
113 liveGroundTruthPath = "../../../data/Motorcade/Motorcade_take53_beats.txt";
|
andrew@48
|
114 rehearsalGroundTruthPath = "../../../data/Motorcade/Motorcade_take57_beats.txt";
|
andrew@48
|
115 liveToRehMultitrackAlignmentPath = "../../../data/Motorcade/motorcade_live53_reh57_output.txt";
|
andrew@48
|
116 liveToRehMatchOFpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OF.out";
|
andrew@48
|
117 liveToRehMatchOBpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OB.out";
|
andrew@49
|
118 ewertReader.swapOrder = false;
|
andrew@49
|
119 ewertAlignmentPath = "../../../data/EwertResults/Motorcade_mix_Take53__Motorcade_mix_Take57.csv";
|
andrew@53
|
120 ewertFlag = true;
|
andrew@48
|
121 break;
|
andrew@48
|
122
|
andrew@48
|
123 case 5:
|
andrew@53
|
124
|
andrew@53
|
125 liveGroundTruthPath = "../../../data/Festival/Festival21_beats.txt";
|
andrew@53
|
126 rehearsalGroundTruthPath = "../../../data/Festival/Festival23_beats.txt";
|
andrew@53
|
127 liveToRehMultitrackAlignmentPath = "../../../data/Festival/FestivalOutput_live21_reh23.txt";
|
andrew@53
|
128 liveToRehMatchOFpath = "../../../data/Festival/Festival_LiveTwo21_RehThree23_match_OF.out";
|
andrew@53
|
129 liveToRehMatchOBpath = "../../../data/Festival/Festival_LiveTwo21_RehThree23_match_OB.out";
|
andrew@55
|
130 ewertAlignmentPath = "../../../data/EwertResults/A_Festival_21__B_Festival_23.csv";
|
andrew@55
|
131 ewertFlag = true;
|
andrew@53
|
132 break;
|
andrew@53
|
133
|
andrew@53
|
134 case 6:
|
andrew@53
|
135
|
andrew@53
|
136 liveGroundTruthPath = "../../../data/StationGate/StationGate_final1_beats.txt";
|
andrew@53
|
137 rehearsalGroundTruthPath = "../../../data/StationGate/StationGate_final2_beats.txt";
|
andrew@53
|
138 liveToRehMultitrackAlignmentPath = "../../../data/StationGate/StationGate_final_reh_takeTwo_liveTakeOne_output.txt";
|
andrew@53
|
139 liveToRehMatchOFpath = "../../../data/StationGate/StationGate_Live1_reh2_match_OF.out";
|
andrew@53
|
140 liveToRehMatchOBpath = "../../../data//StationGate/StationGate_Live1_reh2_match_OB.out";
|
andrew@55
|
141 ewertAlignmentPath = "../../../data/EwertResults/A_StationGate_final_1__B_StationGate_final_2.csv";
|
andrew@55
|
142 ewertFlag = true;
|
andrew@53
|
143 break;
|
andrew@53
|
144
|
andrew@53
|
145 case 7:
|
andrew@53
|
146 liveGroundTruthPath = "../../../data/PennyArcade/PennyArcade_TrRehearsalBeats.txt";
|
andrew@53
|
147 rehearsalGroundTruthPath = "../../../data/PennyArcade/PennyArcade_StudioMixdown_beats.txt";
|
andrew@53
|
148 liveToRehMultitrackAlignmentPath = "../../../data/PennyArcade/PennyArcade_Live_TrRehMay12_Reh_StudioVersion14a_output.txt";
|
andrew@53
|
149 liveToRehMatchOFpath = "../../../data/PennyArcade/PennyArcade_LiveTrReh_rehStudioMix14a_match_OF.out";
|
andrew@53
|
150 liveToRehMatchOBpath = "../../../data/PennyArcade/PennyArcade_LiveTrReh_rehStudioMix14a_match_OB.out";
|
andrew@55
|
151 ewertAlignmentPath = "../../../data/EwertResults/A_PennyArcade_trRehearsalMay1__B_PennyArcade_StudioMixdown.csv";
|
andrew@55
|
152 ewertFlag = true;
|
andrew@53
|
153 break;
|
andrew@53
|
154
|
andrew@53
|
155
|
andrew@53
|
156 case 8:
|
andrew@48
|
157 //THESE NEED FIXING OF GROUTND TRUTH BEATS
|
andrew@53
|
158 liveGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take2_beats.txt";
|
andrew@53
|
159 rehearsalGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take3_beats.txt";
|
andrew@48
|
160 liveToRehMultitrackAlignmentPath = "../../../data/SonOfMan/SonOfMan_live2_reh3_thinner_output.txt";
|
andrew@48
|
161 liveToRehMatchOFpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OF.out";
|
andrew@48
|
162 liveToRehMatchOBpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OB.out";
|
andrew@53
|
163 ewertAlignmentPath = "../../../data/SonOfMan/SonOfMan_take2__SonOfMan_take3.csv";
|
andrew@53
|
164 ewertFlag = true;
|
andrew@53
|
165 break;
|
andrew@53
|
166
|
andrew@53
|
167 case 9:
|
andrew@53
|
168 liveGroundTruthPath = "../../../data/NewYearsResolution/NewYearsResolution_take6_beats.txt";
|
andrew@53
|
169 rehearsalGroundTruthPath = "../../../data/NewYearsResolution/NewYearsResolution_take11_beats.txt";
|
andrew@53
|
170 liveToRehMultitrackAlignmentPath = "../../../data/NewYearsResolution/NewYearsResolution_liveTakeSix_rehTake11studio_output.txt";
|
andrew@53
|
171 liveToRehMatchOFpath = "../../../data/NewYearsResolution/NewYearsResolution_Live6_reh11_match_OF.out";
|
andrew@53
|
172 liveToRehMatchOBpath = "../../../data/NewYearsResolution/NewYearsResolution_Live6_reh11_match_OB.out";
|
andrew@55
|
173 ewertAlignmentPath = "../../../data/EwertResults/A_NewYearsResolution_take6__B_NewYearsResolution_take11.csv";
|
andrew@55
|
174 ewertFlag = true;
|
andrew@53
|
175 break;
|
andrew@53
|
176
|
andrew@53
|
177 case 10:
|
andrew@53
|
178 liveGroundTruthPath = "../../../data/Stones/Stones_take2_beats.txt";
|
andrew@53
|
179 rehearsalGroundTruthPath = "../../../data/Stones/Stones_take3_beats.txt";
|
andrew@53
|
180 liveToRehMultitrackAlignmentPath = "../../../data/Stones/stones_RehTakeThree_liveTakeTwo_output_new.txt";
|
andrew@53
|
181 liveToRehMatchOFpath = "../../../data/Stones/Stones_liveTake2_RehTake3_OF.out";
|
andrew@53
|
182 liveToRehMatchOBpath = "../../../data/Stones/Stones_liveTake2_RehTake3_OB.out";
|
andrew@55
|
183 ewertAlignmentPath = "../../../data/EwertResults/A_Stones_take2__B_Stones_take3.csv";
|
andrew@55
|
184 ewertFlag = true;
|
andrew@48
|
185 break;
|
andrew@47
|
186
|
andrew@47
|
187 default:
|
andrew@47
|
188 /*liveGroundTruthPath = NULL;
|
andrew@47
|
189 rehearsalGroundTruthPath = NULL;
|
andrew@47
|
190 liveToRehMultitrackAlignmentPath = NULL;
|
andrew@47
|
191 liveToRehMatchOFpath = NULL;
|
andrew@47
|
192 liveToRehMatchOBpath = NULL;
|
andrew@47
|
193 */
|
andrew@47
|
194 break;
|
andrew@47
|
195 }
|
andrew@47
|
196
|
andrew@47
|
197
|
andrew@47
|
198
|
andrew@47
|
199 }
|
andrew@47
|
200
|
andrew@47
|
201
|
andrew@47
|
202 void testApp::readInFiles(){
|
andrew@49
|
203 GroundTruth.clear();
|
andrew@49
|
204
|
andrew@47
|
205 //so we have our first file list of ground truth beats
|
andrew@47
|
206 beatReader.readInBeatsFile(liveGroundTruthPath);
|
andrew@47
|
207 GroundTruth.push_back(beatReader.beatTimes);
|
andrew@47
|
208 //then the second i.e. analysed list of beats
|
andrew@47
|
209 beatReader.readInBeatsFile(rehearsalGroundTruthPath);
|
andrew@47
|
210 GroundTruth.push_back(beatReader.beatTimes);
|
andrew@47
|
211 //so GroundTruth[0] is the DoubleVector of file 1 beats
|
andrew@47
|
212 //this is the Live file - i.e. played along
|
andrew@47
|
213 //i.e. GT[0][0] - first, GT[0][1] second and so on
|
andrew@47
|
214
|
andrew@47
|
215 //Then we need to know where our alignment path has projected these positions to be
|
andrew@47
|
216 beatReader.readInMultiAlignmentFile(liveToRehMultitrackAlignmentPath);
|
andrew@47
|
217
|
andrew@47
|
218 //read in the alignments from Match algorithm - first backwards, non-causal, path
|
andrew@47
|
219 matchBackwardsNotations.readInMatchFile(liveToRehMatchOBpath);
|
andrew@47
|
220
|
andrew@47
|
221 //and forwards
|
andrew@47
|
222 matchForwardNotations.readInMatchFile(liveToRehMatchOFpath);
|
andrew@47
|
223 matchForwardNotations.reverseAnnotations();//which needs reversing
|
andrew@49
|
224
|
andrew@53
|
225 if (ewertFlag)
|
andrew@53
|
226 ewertReader.readInBeatsFile(ewertAlignmentPath);
|
andrew@53
|
227 else{
|
andrew@53
|
228 printf("No alignment file for Ewert method");
|
andrew@53
|
229 }
|
andrew@47
|
230 }
|
andrew@47
|
231
|
andrew@47
|
232
|
andrew@47
|
233 void testApp::processResults(){
|
andrew@47
|
234
|
andrew@47
|
235 printf("\n\nMultitrack Alignment\n");
|
andrew@47
|
236 beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], beatReader.alignmentTimes[0], beatReader.alignmentTimes[1]);
|
andrew@47
|
237 multiHistogram.createHistogram(histogramWidth, histogramBinNumber);
|
andrew@47
|
238 multiHistogram.processDataIntoHistogram(beatReader.errors);
|
andrew@48
|
239 printf("\nMULTI ABS\n");
|
andrew@48
|
240 multiAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
|
andrew@47
|
241
|
andrew@47
|
242 printf("\n\nMATCH BACKWARDS\n");
|
andrew@47
|
243 beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchBackwardsNotations.matchLiveTimes, matchBackwardsNotations.matchRehearsalTimes);
|
andrew@47
|
244 matchBackwardsHistogram.createHistogram(histogramWidth, histogramBinNumber);
|
andrew@47
|
245 matchBackwardsHistogram.processDataIntoHistogram(beatReader.errors);
|
andrew@48
|
246 printf("\nMATCH OB ABS\n");
|
andrew@48
|
247 matchBackwardsAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
|
andrew@47
|
248
|
andrew@47
|
249 printf("\n\nMATCH FORWARDS\n");
|
andrew@47
|
250 beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchForwardNotations.matchLiveTimes, matchForwardNotations.matchRehearsalTimes);
|
andrew@47
|
251 matchForwardHistogram.createHistogram(histogramWidth, histogramBinNumber);
|
andrew@47
|
252 matchForwardHistogram.processDataIntoHistogram(beatReader.errors);
|
andrew@48
|
253 printf("\nMATCH OF ABS\n");
|
andrew@48
|
254 matchForwardAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
|
andrew@47
|
255
|
andrew@49
|
256 if (ewertReader.annotationsLoaded){
|
andrew@49
|
257 printf("\n\nEWERT TIMES %i \n", ewertReader.alignmentTimes[0].size());
|
andrew@49
|
258
|
andrew@49
|
259 beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], ewertReader.alignmentTimes[0], ewertReader.alignmentTimes[1]);
|
andrew@49
|
260 ewertHistogram.createHistogram(histogramWidth, histogramBinNumber);
|
andrew@49
|
261 ewertHistogram.processDataIntoHistogram(beatReader.errors);
|
andrew@49
|
262 printf("\nEWERT ABS\n");
|
andrew@49
|
263 ewertAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors);
|
andrew@49
|
264 }
|
andrew@49
|
265
|
andrew@49
|
266 }
|
andrew@49
|
267
|
andrew@49
|
268 void testApp::printPercentageTotals(){
|
andrew@49
|
269 printf("\nMULTI TOTAL\n");
|
andrew@49
|
270 multiAbsTotalHistogram.printHistogramPercentages();
|
andrew@49
|
271 printf("\nMATCH OF TOTAL\n");
|
andrew@49
|
272 matchForwardAbsTotalHistogram.printHistogramPercentages();
|
andrew@49
|
273 printf("\nMATCH OB TOTAL\n");
|
andrew@49
|
274 matchBackwardsAbsTotalHistogram.printHistogramPercentages();
|
andrew@49
|
275 printf("\nEWERT TOTAL\n");
|
andrew@49
|
276 ewertAbsTotalHistogram.printHistogramPercentages();
|
andrew@47
|
277 }
|
andrew@47
|
278
|
andrew@43
|
279 //--------------------------------------------------------------
|
andrew@43
|
280 void testApp::update(){
|
andrew@43
|
281
|
andrew@43
|
282 }
|
andrew@43
|
283
|
andrew@43
|
284 //--------------------------------------------------------------
|
andrew@43
|
285 void testApp::draw(){
|
andrew@45
|
286 switch (screenToDraw) {
|
andrew@45
|
287 case 0:
|
andrew@45
|
288 drawAlignmentVectors();
|
andrew@45
|
289 break;
|
andrew@45
|
290 case 1:
|
andrew@45
|
291 ofSetColor(0,0,255);
|
andrew@45
|
292 multiHistogram.plotHistogram();
|
andrew@45
|
293 break;
|
andrew@45
|
294 case 2:
|
andrew@45
|
295 ofSetColor(0,255,0);
|
andrew@46
|
296 matchBackwardsHistogram.plotHistogram();
|
andrew@46
|
297 break;
|
andrew@46
|
298 case 3:
|
andrew@46
|
299 ofSetColor(0,155,0);
|
andrew@46
|
300 matchForwardHistogram.plotHistogram();
|
andrew@45
|
301 break;
|
andrew@49
|
302 case 4:
|
andrew@49
|
303 ofSetColor(0,0,255);
|
andrew@49
|
304 multiAbsTotalHistogram.plotHistogram();
|
andrew@49
|
305 ofSetColor(0);
|
andrew@49
|
306 multiAbsTotalHistogram.labelHistogram();
|
andrew@49
|
307 break;
|
andrew@49
|
308 case 5:
|
andrew@49
|
309 ofSetColor(0,255,0);
|
andrew@49
|
310 matchBackwardsAbsTotalHistogram.plotHistogram();
|
andrew@49
|
311 ofSetColor(0);
|
andrew@49
|
312 matchBackwardsAbsTotalHistogram.labelHistogram();
|
andrew@49
|
313 break;
|
andrew@49
|
314 case 6:
|
andrew@49
|
315 ofSetColor(0,155,0);
|
andrew@49
|
316 matchForwardAbsTotalHistogram.plotHistogram();
|
andrew@49
|
317 ofSetColor(0);
|
andrew@49
|
318 matchForwardAbsTotalHistogram.labelHistogram();
|
andrew@49
|
319 break;
|
andrew@49
|
320 case 7:
|
andrew@49
|
321 ofSetColor(155,0,0);
|
andrew@49
|
322 ewertHistogram.plotHistogram();
|
andrew@49
|
323 ofSetColor(0);
|
andrew@49
|
324 ewertHistogram.labelHistogram();
|
andrew@49
|
325 break;
|
andrew@49
|
326
|
andrew@49
|
327 case 8:
|
andrew@49
|
328 ofSetColor(255,0,0);
|
andrew@49
|
329 ewertAbsTotalHistogram.plotHistogram();
|
andrew@49
|
330 ofSetColor(0);
|
andrew@49
|
331 ewertAbsTotalHistogram.labelHistogram();
|
andrew@49
|
332 break;
|
andrew@49
|
333
|
andrew@46
|
334
|
andrew@45
|
335 }
|
andrew@47
|
336
|
andrew@47
|
337 if (squareBeingDragged)
|
andrew@47
|
338 drawSquare();
|
andrew@45
|
339 }
|
andrew@43
|
340
|
andrew@45
|
341
|
andrew@47
|
342 void testApp::drawSquare(){
|
andrew@47
|
343 ofSetColor(100,100,100);
|
andrew@47
|
344 ofRect(squareX, squareY, squareWidth, squareHeight);
|
andrew@47
|
345 }
|
andrew@47
|
346
|
andrew@45
|
347 void testApp::drawAlignmentVectors(){
|
andrew@45
|
348
|
andrew@43
|
349 ofSetColor(0,0,0);
|
andrew@45
|
350 // plotter.plotVector(beatReader.beatTimes);
|
andrew@43
|
351 int limit = 50;
|
andrew@45
|
352 //live is X
|
andrew@45
|
353 //rehearsal is Y
|
andrew@45
|
354 plotter.plotTwoVectors(GroundTruth[0], GroundTruth[1], xPlotMin, xPlotMax, yPlotMin, yPlotMax, true);
|
andrew@45
|
355
|
andrew@45
|
356 //x axis is the live time
|
andrew@43
|
357
|
andrew@43
|
358 ofSetColor(0,0,200);
|
andrew@45
|
359 plotter.plotTwoVectors(beatReader.alignmentTimes[0], beatReader.alignmentTimes[1], xPlotMin, xPlotMax, yPlotMin, yPlotMax, false);
|
andrew@45
|
360
|
andrew@44
|
361 ofSetColor(200,0,0);
|
andrew@45
|
362 plotter.plotTwoVectors(beatReader.alignmentTimes[0], beatReader.alignmentTimes[2], xPlotMin, xPlotMax, yPlotMin, yPlotMax, false);
|
andrew@45
|
363
|
andrew@45
|
364 ofSetColor(0,200,0);
|
andrew@46
|
365 plotter.plotTwoVectors(matchBackwardsNotations.matchLiveTimes, matchBackwardsNotations.matchRehearsalTimes, xPlotMin, xPlotMax, yPlotMin, yPlotMax, false);
|
andrew@46
|
366
|
andrew@46
|
367 ofSetColor(0,200, 200);
|
andrew@46
|
368 plotter.plotTwoVectors(matchForwardNotations.matchLiveTimes, matchForwardNotations.matchRehearsalTimes, xPlotMin, xPlotMax, yPlotMin, yPlotMax, false);
|
andrew@45
|
369
|
andrew@44
|
370
|
andrew@43
|
371 }
|
andrew@43
|
372
|
andrew@47
|
373
|
andrew@47
|
374 void testApp::setCoordinatesToSquare(){
|
andrew@47
|
375 xPlotMin += (xPlotMax - xPlotMin)*squareX / ofGetWidth();
|
andrew@47
|
376 xPlotMax = xPlotMin + ((xPlotMax - xPlotMin)*(squareX + squareWidth)/ ofGetWidth());
|
andrew@47
|
377 double screenHeight = (double)ofGetHeight();
|
andrew@47
|
378 yPlotMax -= (yPlotMax - yPlotMin) * (squareY)/screenHeight ;
|
andrew@47
|
379 yPlotMin += (yPlotMax - yPlotMin) * (screenHeight - squareY - squareHeight)/screenHeight;
|
andrew@47
|
380 }
|
andrew@47
|
381
|
andrew@43
|
382 //--------------------------------------------------------------
|
andrew@43
|
383 void testApp::keyPressed(int key){
|
andrew@43
|
384
|
andrew@43
|
385 if (key == OF_KEY_RIGHT){
|
andrew@47
|
386 double tmp = 0.5*(xPlotMax - xPlotMin);
|
andrew@47
|
387 xPlotMax += tmp;
|
andrew@47
|
388 xPlotMin += tmp;
|
andrew@45
|
389 getYvalues();
|
andrew@43
|
390 }
|
andrew@43
|
391
|
andrew@45
|
392 if (key == OF_KEY_LEFT){
|
andrew@47
|
393 double tmp = 0.5*(xPlotMax - xPlotMin);
|
andrew@47
|
394 xPlotMin -= tmp;
|
andrew@47
|
395 xPlotMax -= tmp;
|
andrew@45
|
396 getYvalues();
|
andrew@43
|
397 }
|
andrew@43
|
398
|
andrew@43
|
399 if (key == OF_KEY_UP){
|
andrew@43
|
400 xPlotMax = xPlotMin/2 + xPlotMax/2 ;
|
andrew@43
|
401 yPlotMax = yPlotMin/2 + yPlotMax/2;
|
andrew@43
|
402 }
|
andrew@43
|
403
|
andrew@43
|
404 if (key == OF_KEY_DOWN){
|
andrew@43
|
405 xPlotMax = -1*xPlotMin + 2*xPlotMax ;
|
andrew@43
|
406 yPlotMax = -1*xPlotMin + 2*yPlotMax;
|
andrew@43
|
407 }
|
andrew@47
|
408
|
andrew@47
|
409 if (key == OF_KEY_RETURN){
|
andrew@47
|
410 xPlotMin = 0;
|
andrew@47
|
411 xPlotMax = beatReader.alignmentTimes[0][beatReader.alignmentTimes[0].size()-1];
|
andrew@47
|
412 yPlotMin = 0;
|
andrew@47
|
413 yPlotMax = beatReader.alignmentTimes[1][beatReader.alignmentTimes[1].size()-1];;
|
andrew@47
|
414 }
|
andrew@45
|
415
|
andrew@45
|
416 if (key == 's'){
|
andrew@45
|
417 screenToDraw++;
|
andrew@45
|
418
|
andrew@45
|
419 if (screenToDraw == NUMBER_OF_SCREENS)
|
andrew@45
|
420 screenToDraw = 0;
|
andrew@45
|
421
|
andrew@45
|
422 }
|
andrew@45
|
423
|
andrew@45
|
424 }
|
andrew@45
|
425
|
andrew@45
|
426 void testApp::getYvalues(){
|
andrew@45
|
427 //we have xmin and max
|
andrew@45
|
428 // need the y equivalent
|
andrew@45
|
429 int index = 0;
|
andrew@45
|
430 while (index < beatReader.alignmentTimes[0].size() && beatReader.alignmentTimes[0][index] < xPlotMin){
|
andrew@45
|
431 index++;
|
andrew@45
|
432 //printf("beat[%i]: %f\n", index, beatReader.alignmentTimes[0][index]);
|
andrew@45
|
433 }
|
andrew@45
|
434
|
andrew@45
|
435 //printf("found index %i, size %i, at val %.3f\n", index, (int)beatReader.alignmentTimes[0].size(), beatReader.alignmentTimes[0][index]);
|
andrew@45
|
436
|
andrew@45
|
437 yPlotMin = beatReader.alignmentTimes[1][index];
|
andrew@45
|
438
|
andrew@45
|
439 while (index < beatReader.alignmentTimes[0].size() && beatReader.alignmentTimes[0][index] < xPlotMax)
|
andrew@45
|
440 index++;
|
andrew@45
|
441
|
andrew@45
|
442 yPlotMax = beatReader.alignmentTimes[1][index];
|
andrew@45
|
443
|
andrew@45
|
444
|
andrew@48
|
445 //printPlotValues();
|
andrew@45
|
446 }
|
andrew@45
|
447
|
andrew@45
|
448 void testApp::printPlotValues(){
|
andrew@45
|
449 printf("xmin %.0f, mxax %.0f\n", xPlotMin, xPlotMax);
|
andrew@45
|
450 printf("ymin %.0f, ymax %.0f\n", yPlotMin, yPlotMax);
|
andrew@43
|
451 }
|
andrew@43
|
452
|
andrew@43
|
453 //--------------------------------------------------------------
|
andrew@43
|
454 void testApp::keyReleased(int key){
|
andrew@43
|
455
|
andrew@43
|
456 }
|
andrew@43
|
457
|
andrew@43
|
458 //--------------------------------------------------------------
|
andrew@43
|
459 void testApp::mouseMoved(int x, int y ){
|
andrew@43
|
460
|
andrew@43
|
461 }
|
andrew@43
|
462
|
andrew@43
|
463 //--------------------------------------------------------------
|
andrew@43
|
464 void testApp::mouseDragged(int x, int y, int button){
|
andrew@47
|
465 squareWidth = x - squareX;
|
andrew@47
|
466 squareHeight = y - squareY;
|
andrew@47
|
467 squareBeingDragged = true;
|
andrew@43
|
468 }
|
andrew@43
|
469
|
andrew@43
|
470 //--------------------------------------------------------------
|
andrew@43
|
471 void testApp::mousePressed(int x, int y, int button){
|
andrew@47
|
472 squareX = x;
|
andrew@47
|
473 squareY = y;
|
andrew@43
|
474 }
|
andrew@43
|
475
|
andrew@43
|
476 //--------------------------------------------------------------
|
andrew@43
|
477 void testApp::mouseReleased(int x, int y, int button){
|
andrew@47
|
478 squareBeingDragged = false;
|
andrew@47
|
479 setCoordinatesToSquare();
|
andrew@43
|
480 }
|
andrew@43
|
481
|
andrew@43
|
482 //--------------------------------------------------------------
|
andrew@43
|
483 void testApp::windowResized(int w, int h){
|
andrew@43
|
484
|
andrew@43
|
485 }
|
andrew@43
|
486
|
andrew@43
|
487 //--------------------------------------------------------------
|
andrew@43
|
488 void testApp::gotMessage(ofMessage msg){
|
andrew@43
|
489
|
andrew@43
|
490 }
|
andrew@43
|
491
|
andrew@43
|
492 //--------------------------------------------------------------
|
andrew@43
|
493 void testApp::dragEvent(ofDragInfo dragInfo){
|
andrew@43
|
494
|
andrew@43
|
495 } |