Mercurial > hg > midi-score-follower
comparison 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 |
comparison
equal
deleted
inserted
replaced
35:6cd3e0075adf | 36:5a1b0c6fa1fb |
---|---|
5 this->args = args; | 5 this->args = args; |
6 } | 6 } |
7 | 7 |
8 //-------------------------------------------------------------- | 8 //-------------------------------------------------------------- |
9 void testApp::setup(){ | 9 void testApp::setup(){ |
10 | |
10 | 11 |
11 midiEvents.fileOutput = &myfile; | 12 midiEvents.fileOutput = &myfile; |
12 | 13 |
13 string root = "../../../data/FilesOut/exampletest.txt"; | 14 string root = "../../../data/FilesOut/exampletest.txt"; |
14 myfile.open("../../../data/FilesOut/exampletest.txt"); | 15 myfile.open("../../../data/FilesOut/exampletest.txt"); |
607 // fileLoader.chopBeginning = true; | 608 // fileLoader.chopBeginning = true; |
608 fileLoader.loadFile(filename, midiEvents); | 609 fileLoader.loadFile(filename, midiEvents); |
609 | 610 |
610 }//new end of load function | 611 }//new end of load function |
611 | 612 |
612 | 613 /* |
613 | 614 void testApp::readInSomeValues(){ |
614 | 615 |
616 | |
617 printf("READ FILE\n"); | |
618 ifstream file ( "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C002_annotation+WavPos.csv" ); // declare file stream: http://www.cplusplus.com/reference/iostream/ifstream/ | |
619 string value; | |
620 int count = 0; | |
621 while ( file.good() ) | |
622 { | |
623 getline ( file, value, ',' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/ | |
624 cout << string( value, 1, value.length()-2 ); // display value removing the first and the last character from it | |
625 | |
626 string::size_type start = value.find_first_not_of(" \t\v"); | |
627 string part = value.substr(start, string::npos); | |
628 //printf("%s (%i)\n", part.c_str(), count); | |
629 float my_float; | |
630 int my_int; | |
631 switch (count%6) { | |
632 case 1: | |
633 printf("reading %s\n", part.c_str()); | |
634 my_float = atof(part.c_str()); | |
635 printf("float is %f\n", my_float); | |
636 break; | |
637 case 2: | |
638 printf("reading %s\n", part.c_str()); | |
639 my_int = atoi(part.c_str()); | |
640 printf("float is %i\n", i); | |
641 break; | |
642 | |
643 default: | |
644 break; | |
645 } | |
646 count++; | |
647 } | |
648 | |
649 } | |
650 | |
651 */ | |
652 | |
653 |