diff jnmr/midiEventHolder.cpp @ 37:795a99987875

Added new patcher to test RWC database, automatically loads the file in both Max and the score follower, then stores data to a given text file. Need to fix the annotation checker next
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Thu, 15 Dec 2011 13:02:52 +0000
parents 5a1b0c6fa1fb
children c3d32207565f
line wrap: on
line diff
--- a/jnmr/midiEventHolder.cpp	Thu Dec 15 02:28:49 2011 +0000
+++ b/jnmr/midiEventHolder.cpp	Thu Dec 15 13:02:52 2011 +0000
@@ -12,8 +12,8 @@
 
 #include "midiEventHolder.h"
 
-//#include <iostream>
-//#include <fstream>
+#include <iostream>
+#include <fstream>
 
 midiEventHolder::midiEventHolder(){
 	
@@ -817,11 +817,12 @@
 			annotationNote = myNotation.rwcAnnotations[smoothIndex].midiNote;
 		}
 		
+		float difference = playingTime - (annotationTime*1000.0);
 		
 		if ((*fileOutput).is_open()){
 			(*fileOutput) << fixed << beatPositions[smoothIndex] <<",\t" <<  recordedNoteOnMatrix[smoothIndex][1] << ",\t";
 			(*fileOutput) << playingTime ;
-			float difference = playingTime - (annotationTime*1000.0);
+			
 				if ( recordedNoteOnMatrix[smoothIndex][1] == annotationNote){
 					(*fileOutput) << " corresponds to " << annotationTime;
 				}
@@ -829,6 +830,11 @@
 			
 			printf("midi %i beat pos %f now at %f :: annotaion %i time %f diff \t%f ms\n",  recordedNoteOnMatrix[smoothIndex][1], 
 				   beatPositions[smoothIndex], playingTime, annotationNote, annotationTime, difference);
+	
+		}
+	
+		if ((*differenceOutput).is_open()){
+			(*differenceOutput) << beatPositions[smoothIndex] << "," << difference << "\n";
 		}
 		
 		smoothIndex++;