Mercurial > hg > midi-score-follower
comparison jnmr/testApp.cpp @ 38:c3d32207565f
Annotations autoloading for the various files, still needs proper checker though
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Fri, 16 Dec 2011 17:37:44 +0000 |
parents | 795a99987875 |
children | 776694bcbd02 |
comparison
equal
deleted
inserted
replaced
37:795a99987875 | 38:c3d32207565f |
---|---|
14 | 14 |
15 root = "/Users/andrew/Documents/work/MuseScore/RWC/Classical_RWC_Groundtruth/RM-C0"; | 15 root = "/Users/andrew/Documents/work/MuseScore/RWC/Classical_RWC_Groundtruth/RM-C0"; |
16 outputFileRoot = "../../../data/FilesOut/rwcOutputData_RM-C0"; | 16 outputFileRoot = "../../../data/FilesOut/rwcOutputData_RM-C0"; |
17 | 17 |
18 myfile.open("../../../data/FilesOut/exampletest2.txt"); | 18 myfile.open("../../../data/FilesOut/exampletest2.txt"); |
19 diffFile.open("../../../data/FilesOut/diffTest.txt"); | 19 // diffFile.open("../../../data/FilesOut/diffTest.txt"); |
20 | |
21 if (myfile.is_open()) | |
22 { | |
23 // myfile << "This is a line.\n"; | |
24 // myfile << "This is another line.\n"; | |
25 // myfile.close(); | |
26 printf("WRITING TO TEXT FILE\n"); | |
27 } | |
28 else cout << "Unable to open example file"; | |
29 | |
30 | 20 |
31 this->args->printArgs(); | 21 this->args->printArgs(); |
32 this->args->printOpts(); | 22 this->args->printOpts(); |
33 | 23 |
34 loadRWCfileNumber(2); | 24 loadRWCfileNumber(2); |
25 openOutputFile(2); | |
26 loadAnnotation(2); | |
35 | 27 |
36 /* if (this->args->getCount() > 0){ | 28 /* if (this->args->getCount() > 0){ |
37 museScoreFilename = this->args->getString(1); | 29 museScoreFilename = this->args->getString(1); |
38 //printf("MUSESCORE FILENAME IS %s\n", museScoreFilename); | 30 //printf("MUSESCORE FILENAME IS %s\n", museScoreFilename); |
39 cout << "running!! " << museScoreFilename << endl; | 31 cout << "running!! " << museScoreFilename << endl; |
215 } | 207 } |
216 | 208 |
217 if ( m.getAddress() == "/RWCfile" ){ | 209 if ( m.getAddress() == "/RWCfile" ){ |
218 openOutputFile(m.getArgAsInt32(0)); | 210 openOutputFile(m.getArgAsInt32(0)); |
219 loadRWCfileNumber(m.getArgAsInt32(0)); | 211 loadRWCfileNumber(m.getArgAsInt32(0)); |
212 loadAnnotation(m.getArgAsInt32(0)); | |
220 } | 213 } |
221 | 214 |
222 | 215 |
223 }//end while osc | 216 }//end while osc |
224 if (midiEvents.recordedEventTimes.size() > 0) | 217 if (midiEvents.recordedEventTimes.size() > 0) |
603 } | 596 } |
604 | 597 |
605 void testApp::openOutputFile(const int& i){ | 598 void testApp::openOutputFile(const int& i){ |
606 if (diffFile.is_open()) | 599 if (diffFile.is_open()) |
607 diffFile.close(); | 600 diffFile.close(); |
608 | 601 string endBit = ".txt"; |
609 string outputFileName; | 602 string outputFileName = makeRWCfilename(outputFileRoot, i, endBit); |
610 | 603 /* |
611 if (i >= 10) | 604 if (i >= 10) |
612 outputFileName = outputFileRoot + ofToString(i)+".txt"; | 605 outputFileName = outputFileRoot + ofToString(i)+".txt"; |
613 else | 606 else |
614 outputFileName = outputFileRoot + "0"+ofToString(i)+".txt"; | 607 outputFileName = outputFileRoot + "0"+ofToString(i)+".txt"; |
615 | 608 */ |
616 diffFile.open(outputFileName.c_str()); | 609 diffFile.open(outputFileName.c_str()); |
617 } | 610 } |
618 | 611 |
619 void testApp::loadRWCfileNumber(const int& i){ | 612 void testApp::loadRWCfileNumber(const int& i){ |
620 if (i >= 1 && i <= 64){ | 613 if (i >= 1 && i <= 64){ |
627 printf("FILE:%s\n", midiFileName.c_str()); | 620 printf("FILE:%s\n", midiFileName.c_str()); |
628 cannamMainFunction(); | 621 cannamMainFunction(); |
629 } | 622 } |
630 } | 623 } |
631 | 624 |
625 std::string testApp::makeRWCfilename(std::string& root, const int& fileID, std::string& endPart){ | |
626 std::string pathName; | |
627 if (fileID >= 1 && fileID <= 64){ | |
628 | |
629 if (fileID >= 10) | |
630 pathName = root + ofToString(fileID)+endPart; | |
631 else | |
632 pathName = root + "0"+ofToString(fileID)+endPart; | |
633 | |
634 printf("MAKE FILE:%s\n", midiFileName.c_str()); | |
635 } | |
636 return pathName; | |
637 } | |
638 | |
639 void testApp::loadAnnotation(const int& fileID){ | |
640 string annotationRoot = "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C0"; | |
641 string annotationEnding = "_annotation+WavPos.csv"; | |
642 string path = makeRWCfilename(annotationRoot, fileID, annotationEnding ); | |
643 midiEvents.myNotation.readInRWCfile(path); | |
644 } | |
632 | 645 |
633 int testApp::cannamMainFunction(){ | 646 int testApp::cannamMainFunction(){ |
634 | 647 |
635 | 648 |
636 midiEvents.clearAllEvents(); | 649 midiEvents.clearAllEvents(); |