view matchAnnotationSrc/testApp.h @ 52:13194a9dca77 tip

Added exporting of image and text data
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Tue, 17 Jul 2012 22:13:10 +0100
parents ef30f465a904
children
line wrap: on
line source
#pragma once

#include "ofMain.h"

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

class TimingResult{
public:
	
	double median;
	double mean;
	int count;
	double percentileCount[7];
	double percentiles[7];
	int type;
	
	TimingResult(){
		median= 0;
		mean = 0;
		count = 0;
		for (int i = 0;i <7;i++){
			percentileCount[i] = 0;
			percentiles[i] = 0;
		}
	}
};



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;
	
	TimingResult final_JNMR_Midi;
	TimingResult final_Match_OF;
	TimingResult final_Match_OB;
	
	
	std::string matchRoot;// = "/Users/andrew/Documents/work/programming/Shell Scripts/MatchMidiToMidiOutput/RWCmatch_RM-C";
	void getResults(const int& fileID);
	void calculateOverallPercentiles();
	void calculateOverallMatchPercentiles();
	int fileNumberToTest;
};