view annotationCalculatorSrc/testApp.cpp @ 43:b7ad807c9cde

Added annotation writing and the src for the result calculator
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Fri, 04 May 2012 15:33:36 +0100
parents
children 73fbbc92fdfb
line wrap: on
line source
#include "testApp.h"

//--------------------------------------------------------------
void testApp::setup(){
	ofBackground(255);
	
	std::string path = "../../../data/marbleArch_6_beats.txt";
	beatReader.readInBeatsFile(path);
	GroundTruth.push_back(beatReader.beatTimes);//so we have our first file list of beats
	
	//now get the second file beat list
	path = "../../../data/marbleArch_4_beats.txt";//just the same one for the mo...
	beatReader.readInBeatsFile(path);
	GroundTruth.push_back(beatReader.beatTimes);//so we have our first file list of beats
	
	//so GroundTruth[0] is the DoubleVector of file 1 beats 
	//i.e. GT[0][0] - first, GT[0][1] second and so on
	
	path = "../../../data/marbleArchloaded6_live4.txt";
	//Then we need to know where our alignment path has gone and projected these positions to be
	//so we need to load an alignment path
	//then calculate the error histogram etc
	beatReader.readInMultiAlignmentFile(path);

	
	xPlotMin = 0;
	xPlotMax = 40;
	yPlotMin = 0;
	yPlotMax = 40;
}

//--------------------------------------------------------------
void testApp::update(){

}

//--------------------------------------------------------------
void testApp::draw(){

	ofSetColor(0,0,0);
//	plotter.plotVector(beatReader.beatTimes);
	int limit = 50;
		plotter.plotTwoVectors(GroundTruth[0], GroundTruth[1], xPlotMin, xPlotMax, yPlotMin, yPlotMax);
	
	ofSetColor(0,0,200);
	plotter.plotTwoVectors(beatReader.alignmentTimes[1], beatReader.alignmentTimes[0], xPlotMin, xPlotMax, yPlotMin, yPlotMax);
	//plotter.plotVector(beatReader.beatTimes, 0, 100, 0, 100);
}

//--------------------------------------------------------------
void testApp::keyPressed(int key){

	if (key == OF_KEY_RIGHT){
		xPlotMax += 20;
		xPlotMin += 20;
	}
	
	if (key == OF_KEY_RIGHT){
		xPlotMin -= 20;
		xPlotMax -= 20;
	}
	
	if (key == OF_KEY_UP){
		xPlotMax = xPlotMin/2 + xPlotMax/2 ;
		yPlotMax = yPlotMin/2 + yPlotMax/2;
	}
	
	if (key == OF_KEY_DOWN){
		xPlotMax = -1*xPlotMin + 2*xPlotMax ;
		yPlotMax = -1*xPlotMin + 2*yPlotMax;
	}
}

//--------------------------------------------------------------
void testApp::keyReleased(int key){

}

//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void testApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void testApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void testApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void testApp::dragEvent(ofDragInfo dragInfo){ 

}