Mercurial > hg > midi-score-follower
diff 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 |
line wrap: on
line diff
--- a/jnmr/testApp.cpp Thu Dec 15 13:02:52 2011 +0000 +++ b/jnmr/testApp.cpp Fri Dec 16 17:37:44 2011 +0000 @@ -16,22 +16,14 @@ outputFileRoot = "../../../data/FilesOut/rwcOutputData_RM-C0"; myfile.open("../../../data/FilesOut/exampletest2.txt"); - diffFile.open("../../../data/FilesOut/diffTest.txt"); - - if (myfile.is_open()) - { - // myfile << "This is a line.\n"; - // myfile << "This is another line.\n"; -// myfile.close(); - printf("WRITING TO TEXT FILE\n"); - } - else cout << "Unable to open example file"; - +// diffFile.open("../../../data/FilesOut/diffTest.txt"); this->args->printArgs(); this->args->printOpts(); loadRWCfileNumber(2); + openOutputFile(2); + loadAnnotation(2); /* if (this->args->getCount() > 0){ museScoreFilename = this->args->getString(1); @@ -217,6 +209,7 @@ if ( m.getAddress() == "/RWCfile" ){ openOutputFile(m.getArgAsInt32(0)); loadRWCfileNumber(m.getArgAsInt32(0)); + loadAnnotation(m.getArgAsInt32(0)); } @@ -605,14 +598,14 @@ void testApp::openOutputFile(const int& i){ if (diffFile.is_open()) diffFile.close(); - - string outputFileName; - + string endBit = ".txt"; + string outputFileName = makeRWCfilename(outputFileRoot, i, endBit); + /* if (i >= 10) outputFileName = outputFileRoot + ofToString(i)+".txt"; else outputFileName = outputFileRoot + "0"+ofToString(i)+".txt"; - + */ diffFile.open(outputFileName.c_str()); } @@ -629,6 +622,26 @@ } } +std::string testApp::makeRWCfilename(std::string& root, const int& fileID, std::string& endPart){ + std::string pathName; + if (fileID >= 1 && fileID <= 64){ + + if (fileID >= 10) + pathName = root + ofToString(fileID)+endPart; + else + pathName = root + "0"+ofToString(fileID)+endPart; + + printf("MAKE FILE:%s\n", midiFileName.c_str()); + } + return pathName; +} + +void testApp::loadAnnotation(const int& fileID){ + string annotationRoot = "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C0"; + string annotationEnding = "_annotation+WavPos.csv"; + string path = makeRWCfilename(annotationRoot, fileID, annotationEnding ); + midiEvents.myNotation.readInRWCfile(path); +} int testApp::cannamMainFunction(){