andrew@43: #include "testApp.h" andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::setup(){ andrew@43: ofBackground(255); andrew@46: histogramWidth = 10; andrew@46: histogramBinNumber = 25; andrew@43: andrew@53: ewertFlag = true; andrew@48: andrew@49: // multiAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber); andrew@49: // matchBackwardsAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber); andrew@49: // matchForwardAbsTotalHistogram.createAbsoluteHistogram(histogramWidth, histogramBinNumber); andrew@49: andrew@49: andrew@49: multiAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber); andrew@49: matchBackwardsAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber); andrew@49: matchForwardAbsTotalHistogram.createAbsoluteHistogramForMatchData();//(histogramWidth, histogramBinNumber); andrew@49: andrew@49: ewertAbsTotalHistogram.createAbsoluteHistogramForMatchData(); andrew@48: //processFile(0); andrew@48: andrew@53: for (int i = 0;i < 11;i++){ andrew@48: processFile(i); andrew@48: } andrew@45: andrew@49: printPercentageTotals(); andrew@49: andrew@45: screenToDraw = 1; andrew@45: andrew@49: int maxi = max(multiAbsTotalHistogram.maximum, matchForwardAbsTotalHistogram.maximum); andrew@49: maxi = max(maxi, (int)matchBackwardsAbsTotalHistogram.maximum); andrew@49: maxi += 10; andrew@49: multiAbsTotalHistogram.maximum = maxi; andrew@49: matchForwardAbsTotalHistogram.maximum = maxi; andrew@49: matchBackwardsAbsTotalHistogram.maximum = maxi; andrew@49: andrew@45: andrew@43: xPlotMin = 0; andrew@43: xPlotMax = 40; andrew@43: yPlotMin = 0; andrew@43: yPlotMax = 40; andrew@49: andrew@49: readEwertAnnotations(); andrew@49: } andrew@49: andrew@49: void testApp::readEwertAnnotations(){ andrew@49: andrew@49: std::string path = "/Users/andrew/Dropbox/MultitrackAlignmentTesting/__Synchronized"; andrew@49: path += "/DiamondWhite_Take1__DiamondWhite_Take2.csv"; andrew@49: ewertReader.readInBeatsFile(path); andrew@49: andrew@43: } andrew@43: andrew@47: andrew@48: void testApp::processFile(int file){ andrew@48: setFilePaths(file); andrew@48: readInFiles(); andrew@48: processResults(); andrew@48: } andrew@48: andrew@47: void testApp::setFilePaths(int fileToLoad){ andrew@47: andrew@47: switch (fileToLoad) { andrew@47: case 0: andrew@48: liveGroundTruthPath = "../../../data/MarbleArch/marbleArch_4_beats.txt"; andrew@48: rehearsalGroundTruthPath = "../../../data/MarbleArch/marbleArch_6_beats.txt"; andrew@48: liveToRehMultitrackAlignmentPath = "../../../data/MarbleArch/MarbleArch_live4_reh6_newOutput.txt"; andrew@48: liveToRehMatchOFpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OF.out"; andrew@48: liveToRehMatchOBpath = "../../../data/MarbleArch/marbleArchlive4_reh6_match_OB.out"; andrew@49: ewertReader.swapOrder = false; andrew@49: ewertAlignmentPath = "../../../data/EwertResults/MarbleArch_Take4_multiMix__MarbleArch_Take6_multiMix.csv"; andrew@53: ewertFlag = true; andrew@47: break; andrew@50: andrew@47: case 1: andrew@47: liveGroundTruthPath = "../../../data/Lewes/LewesTake14_beatsSV.txt"; andrew@47: rehearsalGroundTruthPath = "../../../data/Lewes/Take13_proper_beatsSV.txt"; andrew@47: liveToRehMultitrackAlignmentPath = "../../../data/Lewes/LewesLiveTake14_rehTake13proper_output.txt"; andrew@47: liveToRehMatchOFpath = "../../../data/Lewes/LewesLive14_reh13p_match_OF.out"; andrew@47: liveToRehMatchOBpath = "../../../data/Lewes/LewesLive14_reh13p_match_OB.out"; andrew@49: ewertReader.swapOrder = true; andrew@49: ewertAlignmentPath = "../../../data/EwertResults/Lewes_Take13_Newproper_Multimix__Lewes_Take14_Multimix.csv"; andrew@53: ewertFlag = true; andrew@47: break; andrew@48: case 2: andrew@48: liveGroundTruthPath = "../../../data/Wanderlust/wanderlust_take15_svBeats.txt"; andrew@48: rehearsalGroundTruthPath = "../../../data/Wanderlust/wanderlust_take16_svBeats.txt"; andrew@48: // liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_output.txt"; andrew@48: // liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wanderlust_live15_reh16_2_output.txt"; andrew@48: liveToRehMultitrackAlignmentPath = "../../../data/Wanderlust/wandelust_live15_reh16_3_output_4msonsetw_dot2like.txt"; andrew@48: liveToRehMatchOFpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OF.out"; andrew@48: liveToRehMatchOBpath = "../../../data/Wanderlust/wanderlustLive15_reh16_match_OB.out"; andrew@49: ewertReader.swapOrder = false; andrew@49: ewertAlignmentPath = "../../../data/EwertResults/Wanderlust_Take15__Wanderlust_Take16.csv"; andrew@53: ewertFlag = true; andrew@48: break; andrew@48: andrew@48: case 3: andrew@48: //THESE NEED FIXING OF GROUTND TRUTH BEATS andrew@48: liveGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take1_beats.txt"; andrew@48: rehearsalGroundTruthPath = "../../../data/DiamondWhite/DiamondWhite_Take2_beats.txt"; andrew@48: liveToRehMultitrackAlignmentPath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_new_output.txt"; andrew@48: liveToRehMatchOFpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OF.out"; andrew@48: liveToRehMatchOBpath = "../../../data/DiamondWhite/DiamondWhite_live1_reh2_match_OB.out"; andrew@49: ewertReader.swapOrder = false; andrew@49: ewertAlignmentPath = "../../../data/EwertResults/DiamondWhite_Take1__DiamondWhite_Take2.csv"; andrew@53: ewertFlag = true; andrew@48: break; andrew@48: andrew@48: case 4: andrew@48: //THESE NEED FIXING OF GROUTND TRUTH BEATS andrew@48: liveGroundTruthPath = "../../../data/Motorcade/Motorcade_take53_beats.txt"; andrew@48: rehearsalGroundTruthPath = "../../../data/Motorcade/Motorcade_take57_beats.txt"; andrew@48: liveToRehMultitrackAlignmentPath = "../../../data/Motorcade/motorcade_live53_reh57_output.txt"; andrew@48: liveToRehMatchOFpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OF.out"; andrew@48: liveToRehMatchOBpath = "../../../data/Motorcade/Motorcade_live53_reh57_match_OB.out"; andrew@49: ewertReader.swapOrder = false; andrew@49: ewertAlignmentPath = "../../../data/EwertResults/Motorcade_mix_Take53__Motorcade_mix_Take57.csv"; andrew@53: ewertFlag = true; andrew@48: break; andrew@48: andrew@48: case 5: andrew@53: andrew@53: liveGroundTruthPath = "../../../data/Festival/Festival21_beats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/Festival/Festival23_beats.txt"; andrew@53: liveToRehMultitrackAlignmentPath = "../../../data/Festival/FestivalOutput_live21_reh23.txt"; andrew@53: liveToRehMatchOFpath = "../../../data/Festival/Festival_LiveTwo21_RehThree23_match_OF.out"; andrew@53: liveToRehMatchOBpath = "../../../data/Festival/Festival_LiveTwo21_RehThree23_match_OB.out"; andrew@55: ewertAlignmentPath = "../../../data/EwertResults/A_Festival_21__B_Festival_23.csv"; andrew@55: ewertFlag = true; andrew@53: break; andrew@53: andrew@53: case 6: andrew@53: andrew@53: liveGroundTruthPath = "../../../data/StationGate/StationGate_final1_beats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/StationGate/StationGate_final2_beats.txt"; andrew@53: liveToRehMultitrackAlignmentPath = "../../../data/StationGate/StationGate_final_reh_takeTwo_liveTakeOne_output.txt"; andrew@53: liveToRehMatchOFpath = "../../../data/StationGate/StationGate_Live1_reh2_match_OF.out"; andrew@53: liveToRehMatchOBpath = "../../../data//StationGate/StationGate_Live1_reh2_match_OB.out"; andrew@55: ewertAlignmentPath = "../../../data/EwertResults/A_StationGate_final_1__B_StationGate_final_2.csv"; andrew@55: ewertFlag = true; andrew@53: break; andrew@53: andrew@53: case 7: andrew@53: liveGroundTruthPath = "../../../data/PennyArcade/PennyArcade_TrRehearsalBeats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/PennyArcade/PennyArcade_StudioMixdown_beats.txt"; andrew@53: liveToRehMultitrackAlignmentPath = "../../../data/PennyArcade/PennyArcade_Live_TrRehMay12_Reh_StudioVersion14a_output.txt"; andrew@53: liveToRehMatchOFpath = "../../../data/PennyArcade/PennyArcade_LiveTrReh_rehStudioMix14a_match_OF.out"; andrew@53: liveToRehMatchOBpath = "../../../data/PennyArcade/PennyArcade_LiveTrReh_rehStudioMix14a_match_OB.out"; andrew@55: ewertAlignmentPath = "../../../data/EwertResults/A_PennyArcade_trRehearsalMay1__B_PennyArcade_StudioMixdown.csv"; andrew@55: ewertFlag = true; andrew@53: break; andrew@53: andrew@53: andrew@53: case 8: andrew@48: //THESE NEED FIXING OF GROUTND TRUTH BEATS andrew@53: liveGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take2_beats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/SonOfMan/SonOfMan_take3_beats.txt"; andrew@48: liveToRehMultitrackAlignmentPath = "../../../data/SonOfMan/SonOfMan_live2_reh3_thinner_output.txt"; andrew@48: liveToRehMatchOFpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OF.out"; andrew@48: liveToRehMatchOBpath = "../../../data/SonOfMan/SonOfMan_live2_reh3_match_OB.out"; andrew@53: ewertAlignmentPath = "../../../data/SonOfMan/SonOfMan_take2__SonOfMan_take3.csv"; andrew@53: ewertFlag = true; andrew@53: break; andrew@53: andrew@53: case 9: andrew@53: liveGroundTruthPath = "../../../data/NewYearsResolution/NewYearsResolution_take6_beats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/NewYearsResolution/NewYearsResolution_take11_beats.txt"; andrew@53: liveToRehMultitrackAlignmentPath = "../../../data/NewYearsResolution/NewYearsResolution_liveTakeSix_rehTake11studio_output.txt"; andrew@53: liveToRehMatchOFpath = "../../../data/NewYearsResolution/NewYearsResolution_Live6_reh11_match_OF.out"; andrew@53: liveToRehMatchOBpath = "../../../data/NewYearsResolution/NewYearsResolution_Live6_reh11_match_OB.out"; andrew@55: ewertAlignmentPath = "../../../data/EwertResults/A_NewYearsResolution_take6__B_NewYearsResolution_take11.csv"; andrew@55: ewertFlag = true; andrew@53: break; andrew@53: andrew@53: case 10: andrew@53: liveGroundTruthPath = "../../../data/Stones/Stones_take2_beats.txt"; andrew@53: rehearsalGroundTruthPath = "../../../data/Stones/Stones_take3_beats.txt"; andrew@53: liveToRehMultitrackAlignmentPath = "../../../data/Stones/stones_RehTakeThree_liveTakeTwo_output_new.txt"; andrew@53: liveToRehMatchOFpath = "../../../data/Stones/Stones_liveTake2_RehTake3_OF.out"; andrew@53: liveToRehMatchOBpath = "../../../data/Stones/Stones_liveTake2_RehTake3_OB.out"; andrew@55: ewertAlignmentPath = "../../../data/EwertResults/A_Stones_take2__B_Stones_take3.csv"; andrew@55: ewertFlag = true; andrew@48: break; andrew@47: andrew@47: default: andrew@47: /*liveGroundTruthPath = NULL; andrew@47: rehearsalGroundTruthPath = NULL; andrew@47: liveToRehMultitrackAlignmentPath = NULL; andrew@47: liveToRehMatchOFpath = NULL; andrew@47: liveToRehMatchOBpath = NULL; andrew@47: */ andrew@47: break; andrew@47: } andrew@47: andrew@47: andrew@47: andrew@47: } andrew@47: andrew@47: andrew@47: void testApp::readInFiles(){ andrew@49: GroundTruth.clear(); andrew@49: andrew@47: //so we have our first file list of ground truth beats andrew@47: beatReader.readInBeatsFile(liveGroundTruthPath); andrew@47: GroundTruth.push_back(beatReader.beatTimes); andrew@47: //then the second i.e. analysed list of beats andrew@47: beatReader.readInBeatsFile(rehearsalGroundTruthPath); andrew@47: GroundTruth.push_back(beatReader.beatTimes); andrew@47: //so GroundTruth[0] is the DoubleVector of file 1 beats andrew@47: //this is the Live file - i.e. played along andrew@47: //i.e. GT[0][0] - first, GT[0][1] second and so on andrew@47: andrew@47: //Then we need to know where our alignment path has projected these positions to be andrew@47: beatReader.readInMultiAlignmentFile(liveToRehMultitrackAlignmentPath); andrew@47: andrew@47: //read in the alignments from Match algorithm - first backwards, non-causal, path andrew@47: matchBackwardsNotations.readInMatchFile(liveToRehMatchOBpath); andrew@47: andrew@47: //and forwards andrew@47: matchForwardNotations.readInMatchFile(liveToRehMatchOFpath); andrew@47: matchForwardNotations.reverseAnnotations();//which needs reversing andrew@49: andrew@53: if (ewertFlag) andrew@53: ewertReader.readInBeatsFile(ewertAlignmentPath); andrew@53: else{ andrew@53: printf("No alignment file for Ewert method"); andrew@53: } andrew@47: } andrew@47: andrew@47: andrew@47: void testApp::processResults(){ andrew@47: andrew@47: printf("\n\nMultitrack Alignment\n"); andrew@47: beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], beatReader.alignmentTimes[0], beatReader.alignmentTimes[1]); andrew@47: multiHistogram.createHistogram(histogramWidth, histogramBinNumber); andrew@47: multiHistogram.processDataIntoHistogram(beatReader.errors); andrew@48: printf("\nMULTI ABS\n"); andrew@48: multiAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors); andrew@47: andrew@47: printf("\n\nMATCH BACKWARDS\n"); andrew@47: beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchBackwardsNotations.matchLiveTimes, matchBackwardsNotations.matchRehearsalTimes); andrew@47: matchBackwardsHistogram.createHistogram(histogramWidth, histogramBinNumber); andrew@47: matchBackwardsHistogram.processDataIntoHistogram(beatReader.errors); andrew@48: printf("\nMATCH OB ABS\n"); andrew@48: matchBackwardsAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors); andrew@47: andrew@47: printf("\n\nMATCH FORWARDS\n"); andrew@47: beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], matchForwardNotations.matchLiveTimes, matchForwardNotations.matchRehearsalTimes); andrew@47: matchForwardHistogram.createHistogram(histogramWidth, histogramBinNumber); andrew@47: matchForwardHistogram.processDataIntoHistogram(beatReader.errors); andrew@48: printf("\nMATCH OF ABS\n"); andrew@48: matchForwardAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors); andrew@47: andrew@49: if (ewertReader.annotationsLoaded){ andrew@49: printf("\n\nEWERT TIMES %i \n", ewertReader.alignmentTimes[0].size()); andrew@49: andrew@49: beatReader.calculateMedianError(GroundTruth[0], GroundTruth[1], ewertReader.alignmentTimes[0], ewertReader.alignmentTimes[1]); andrew@49: ewertHistogram.createHistogram(histogramWidth, histogramBinNumber); andrew@49: ewertHistogram.processDataIntoHistogram(beatReader.errors); andrew@49: printf("\nEWERT ABS\n"); andrew@49: ewertAbsTotalHistogram.processDataIntoHistogram(beatReader.absoluteErrors); andrew@49: } andrew@49: andrew@49: } andrew@49: andrew@49: void testApp::printPercentageTotals(){ andrew@49: printf("\nMULTI TOTAL\n"); andrew@49: multiAbsTotalHistogram.printHistogramPercentages(); andrew@49: printf("\nMATCH OF TOTAL\n"); andrew@49: matchForwardAbsTotalHistogram.printHistogramPercentages(); andrew@49: printf("\nMATCH OB TOTAL\n"); andrew@49: matchBackwardsAbsTotalHistogram.printHistogramPercentages(); andrew@49: printf("\nEWERT TOTAL\n"); andrew@49: ewertAbsTotalHistogram.printHistogramPercentages(); andrew@47: } andrew@47: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::update(){ andrew@43: andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::draw(){ andrew@45: switch (screenToDraw) { andrew@45: case 0: andrew@45: drawAlignmentVectors(); andrew@45: break; andrew@45: case 1: andrew@45: ofSetColor(0,0,255); andrew@45: multiHistogram.plotHistogram(); andrew@45: break; andrew@45: case 2: andrew@45: ofSetColor(0,255,0); andrew@46: matchBackwardsHistogram.plotHistogram(); andrew@46: break; andrew@46: case 3: andrew@46: ofSetColor(0,155,0); andrew@46: matchForwardHistogram.plotHistogram(); andrew@45: break; andrew@49: case 4: andrew@49: ofSetColor(0,0,255); andrew@49: multiAbsTotalHistogram.plotHistogram(); andrew@49: ofSetColor(0); andrew@49: multiAbsTotalHistogram.labelHistogram(); andrew@49: break; andrew@49: case 5: andrew@49: ofSetColor(0,255,0); andrew@49: matchBackwardsAbsTotalHistogram.plotHistogram(); andrew@49: ofSetColor(0); andrew@49: matchBackwardsAbsTotalHistogram.labelHistogram(); andrew@49: break; andrew@49: case 6: andrew@49: ofSetColor(0,155,0); andrew@49: matchForwardAbsTotalHistogram.plotHistogram(); andrew@49: ofSetColor(0); andrew@49: matchForwardAbsTotalHistogram.labelHistogram(); andrew@49: break; andrew@49: case 7: andrew@49: ofSetColor(155,0,0); andrew@49: ewertHistogram.plotHistogram(); andrew@49: ofSetColor(0); andrew@49: ewertHistogram.labelHistogram(); andrew@49: break; andrew@49: andrew@49: case 8: andrew@49: ofSetColor(255,0,0); andrew@49: ewertAbsTotalHistogram.plotHistogram(); andrew@49: ofSetColor(0); andrew@49: ewertAbsTotalHistogram.labelHistogram(); andrew@49: break; andrew@49: andrew@46: andrew@45: } andrew@47: andrew@47: if (squareBeingDragged) andrew@47: drawSquare(); andrew@45: } andrew@43: andrew@45: andrew@47: void testApp::drawSquare(){ andrew@47: ofSetColor(100,100,100); andrew@47: ofRect(squareX, squareY, squareWidth, squareHeight); andrew@47: } andrew@47: andrew@45: void testApp::drawAlignmentVectors(){ andrew@45: andrew@43: ofSetColor(0,0,0); andrew@45: // plotter.plotVector(beatReader.beatTimes); andrew@43: int limit = 50; andrew@45: //live is X andrew@45: //rehearsal is Y andrew@45: plotter.plotTwoVectors(GroundTruth[0], GroundTruth[1], xPlotMin, xPlotMax, yPlotMin, yPlotMax, true); andrew@45: andrew@45: //x axis is the live time andrew@43: andrew@43: ofSetColor(0,0,200); andrew@45: plotter.plotTwoVectors(beatReader.alignmentTimes[0], beatReader.alignmentTimes[1], xPlotMin, xPlotMax, yPlotMin, yPlotMax, false); andrew@45: andrew@44: ofSetColor(200,0,0); andrew@45: plotter.plotTwoVectors(beatReader.alignmentTimes[0], beatReader.alignmentTimes[2], xPlotMin, xPlotMax, yPlotMin, yPlotMax, false); andrew@45: andrew@45: ofSetColor(0,200,0); andrew@46: plotter.plotTwoVectors(matchBackwardsNotations.matchLiveTimes, matchBackwardsNotations.matchRehearsalTimes, xPlotMin, xPlotMax, yPlotMin, yPlotMax, false); andrew@46: andrew@46: ofSetColor(0,200, 200); andrew@46: plotter.plotTwoVectors(matchForwardNotations.matchLiveTimes, matchForwardNotations.matchRehearsalTimes, xPlotMin, xPlotMax, yPlotMin, yPlotMax, false); andrew@45: andrew@44: andrew@43: } andrew@43: andrew@47: andrew@47: void testApp::setCoordinatesToSquare(){ andrew@47: xPlotMin += (xPlotMax - xPlotMin)*squareX / ofGetWidth(); andrew@47: xPlotMax = xPlotMin + ((xPlotMax - xPlotMin)*(squareX + squareWidth)/ ofGetWidth()); andrew@47: double screenHeight = (double)ofGetHeight(); andrew@47: yPlotMax -= (yPlotMax - yPlotMin) * (squareY)/screenHeight ; andrew@47: yPlotMin += (yPlotMax - yPlotMin) * (screenHeight - squareY - squareHeight)/screenHeight; andrew@47: } andrew@47: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::keyPressed(int key){ andrew@43: andrew@43: if (key == OF_KEY_RIGHT){ andrew@47: double tmp = 0.5*(xPlotMax - xPlotMin); andrew@47: xPlotMax += tmp; andrew@47: xPlotMin += tmp; andrew@45: getYvalues(); andrew@43: } andrew@43: andrew@45: if (key == OF_KEY_LEFT){ andrew@47: double tmp = 0.5*(xPlotMax - xPlotMin); andrew@47: xPlotMin -= tmp; andrew@47: xPlotMax -= tmp; andrew@45: getYvalues(); andrew@43: } andrew@43: andrew@43: if (key == OF_KEY_UP){ andrew@43: xPlotMax = xPlotMin/2 + xPlotMax/2 ; andrew@43: yPlotMax = yPlotMin/2 + yPlotMax/2; andrew@43: } andrew@43: andrew@43: if (key == OF_KEY_DOWN){ andrew@43: xPlotMax = -1*xPlotMin + 2*xPlotMax ; andrew@43: yPlotMax = -1*xPlotMin + 2*yPlotMax; andrew@43: } andrew@47: andrew@47: if (key == OF_KEY_RETURN){ andrew@47: xPlotMin = 0; andrew@47: xPlotMax = beatReader.alignmentTimes[0][beatReader.alignmentTimes[0].size()-1]; andrew@47: yPlotMin = 0; andrew@47: yPlotMax = beatReader.alignmentTimes[1][beatReader.alignmentTimes[1].size()-1];; andrew@47: } andrew@45: andrew@45: if (key == 's'){ andrew@45: screenToDraw++; andrew@45: andrew@45: if (screenToDraw == NUMBER_OF_SCREENS) andrew@45: screenToDraw = 0; andrew@45: andrew@45: } andrew@45: andrew@45: } andrew@45: andrew@45: void testApp::getYvalues(){ andrew@45: //we have xmin and max andrew@45: // need the y equivalent andrew@45: int index = 0; andrew@45: while (index < beatReader.alignmentTimes[0].size() && beatReader.alignmentTimes[0][index] < xPlotMin){ andrew@45: index++; andrew@45: //printf("beat[%i]: %f\n", index, beatReader.alignmentTimes[0][index]); andrew@45: } andrew@45: andrew@45: //printf("found index %i, size %i, at val %.3f\n", index, (int)beatReader.alignmentTimes[0].size(), beatReader.alignmentTimes[0][index]); andrew@45: andrew@45: yPlotMin = beatReader.alignmentTimes[1][index]; andrew@45: andrew@45: while (index < beatReader.alignmentTimes[0].size() && beatReader.alignmentTimes[0][index] < xPlotMax) andrew@45: index++; andrew@45: andrew@45: yPlotMax = beatReader.alignmentTimes[1][index]; andrew@45: andrew@45: andrew@48: //printPlotValues(); andrew@45: } andrew@45: andrew@45: void testApp::printPlotValues(){ andrew@45: printf("xmin %.0f, mxax %.0f\n", xPlotMin, xPlotMax); andrew@45: printf("ymin %.0f, ymax %.0f\n", yPlotMin, yPlotMax); andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::keyReleased(int key){ andrew@43: andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::mouseMoved(int x, int y ){ andrew@43: andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::mouseDragged(int x, int y, int button){ andrew@47: squareWidth = x - squareX; andrew@47: squareHeight = y - squareY; andrew@47: squareBeingDragged = true; andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::mousePressed(int x, int y, int button){ andrew@47: squareX = x; andrew@47: squareY = y; andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::mouseReleased(int x, int y, int button){ andrew@47: squareBeingDragged = false; andrew@47: setCoordinatesToSquare(); andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::windowResized(int w, int h){ andrew@43: andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::gotMessage(ofMessage msg){ andrew@43: andrew@43: } andrew@43: andrew@43: //-------------------------------------------------------------- andrew@43: void testApp::dragEvent(ofDragInfo dragInfo){ andrew@43: andrew@43: }