view matchAnnotationSrc/testApp.h @ 50:158f5f38e9d3

outputting exact difference for annotations, comparison with match annotations is now working over all rwc files
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Thu, 29 Mar 2012 13:41:59 +0100
parents 3ce6dadd8167
children ef30f465a904
line wrap: on
line source
#pragma once

#include "ofMain.h"

#include "Annotations.h"
#include "matchAnnotations.h"
#include "jnmrMidiPlayerAnnotations.h"

struct TimingResult{
	double median;
	double mean;
	int count;
	double percentileCount[7];
	double percentiles[7];
	int type;
};

class testApp : public ofBaseApp{

	public:
		void setup();
		void update();
		void draw();

		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 dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
		
	Annotations rwcAnnotations;
	
	void loadRWCfileNumber(const int& i);
	vector<std::string> rwcFileNameStrings;
	void createRWCfilenameStrings();
	string annotationRoot ;
	std::string makeRWCfilename(std::string& root, const int& fileID,  std::string& endPart);
	void loadAnnotation(const int& fileID);
	
	string matchPath;
	std::string makeMatchFilename( const int& fileID, std::string matchEnd);
	
	matchAnnotations matchNotations;
	
	string jnmrPlayerPath, jnmrPlayerRoot;
	jnmrMidiPlayerAnnotations jnmrPlayerAnnotations;
	
	void calculateMatchErrors(TimingResult& t);
	void calculateMatchForwardErrors(TimingResult& t);
	
	void sortDifferenceVector(vector<float> diffVec, TimingResult& t);
	void addToPercentiles(float value, TimingResult& t);
	
	vector<TimingResult> matchOF_results;
	vector<TimingResult> matchOB_results;
	vector<TimingResult> JNMR_MidiMatcher_results;
	
	void getResults(const int& fileID);
	int fileNumberToTest;
};