Mercurial > hg > midi-score-follower
diff jnmr/testApp.cpp @ 36:5a1b0c6fa1fb
Added class to read in the csv Annotation file, then write out the respective difference between the performed piece as followed here, and the annotation of RWC by Ewert and Muller
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Thu, 15 Dec 2011 02:28:49 +0000 |
parents | 6cd3e0075adf |
children | 795a99987875 |
line wrap: on
line diff
--- a/jnmr/testApp.cpp Wed Dec 14 17:28:17 2011 +0000 +++ b/jnmr/testApp.cpp Thu Dec 15 02:28:49 2011 +0000 @@ -7,6 +7,7 @@ //-------------------------------------------------------------- void testApp::setup(){ + midiEvents.fileOutput = &myfile; @@ -609,6 +610,44 @@ }//new end of load function +/* +void testApp::readInSomeValues(){ + + printf("READ FILE\n"); + ifstream file ( "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C002_annotation+WavPos.csv" ); // declare file stream: http://www.cplusplus.com/reference/iostream/ifstream/ + string value; + int count = 0; + while ( file.good() ) + { + getline ( file, value, ',' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/ + cout << string( value, 1, value.length()-2 ); // display value removing the first and the last character from it + + string::size_type start = value.find_first_not_of(" \t\v"); + string part = value.substr(start, string::npos); + //printf("%s (%i)\n", part.c_str(), count); + float my_float; + int my_int; + switch (count%6) { + case 1: + printf("reading %s\n", part.c_str()); + my_float = atof(part.c_str()); + printf("float is %f\n", my_float); + break; + case 2: + printf("reading %s\n", part.c_str()); + my_int = atoi(part.c_str()); + printf("float is %i\n", i); + break; + + default: + break; + } + count++; + } + +} + */ +