Mercurial > hg > midi-score-follower
comparison jnmr/testApp.cpp @ 41:60c1f0fbc8f4
Fixed annotation reader to read in beat and event times correctly
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Mon, 23 Jan 2012 20:54:50 +0000 |
parents | 776694bcbd02 |
children | 6c8a048720c3 |
comparison
equal
deleted
inserted
replaced
40:776694bcbd02 | 41:60c1f0fbc8f4 |
---|---|
19 // diffFile.open("../../../data/FilesOut/diffTest.txt"); | 19 // diffFile.open("../../../data/FilesOut/diffTest.txt"); |
20 | 20 |
21 this->args->printArgs(); | 21 this->args->printArgs(); |
22 this->args->printOpts(); | 22 this->args->printOpts(); |
23 | 23 |
24 createRWCfilenameStrings(); | |
25 | |
24 loadRWCfileNumber(2); | 26 loadRWCfileNumber(2); |
25 openOutputFile(2); | 27 openOutputFile(2); |
26 loadAnnotation(2); | 28 loadAnnotation(2); |
27 | 29 |
28 /* if (this->args->getCount() > 0){ | 30 /* if (this->args->getCount() > 0){ |
83 performanceRating = 0.0; | 85 performanceRating = 0.0; |
84 | 86 |
85 liveInputPlaying = false; | 87 liveInputPlaying = false; |
86 lastScoreIndexSent = 0; | 88 lastScoreIndexSent = 0; |
87 midiEvents.bestMatchIndex = 0; | 89 midiEvents.bestMatchIndex = 0; |
90 | |
88 | 91 |
89 } | 92 } |
90 | 93 |
91 //-------------------------------------------------------------- | 94 //-------------------------------------------------------------- |
92 void testApp::update(){ | 95 void testApp::update(){ |
212 loadAnnotation(m.getArgAsInt32(0)); | 215 loadAnnotation(m.getArgAsInt32(0)); |
213 } | 216 } |
214 | 217 |
215 | 218 |
216 }//end while osc | 219 }//end while osc |
220 | |
217 if (midiEvents.recordedEventTimes.size() > 0) | 221 if (midiEvents.recordedEventTimes.size() > 0) |
218 checkNewScoreNote(); | 222 checkNewScoreNote(); |
219 | 223 |
220 } | 224 } |
221 | 225 |
618 */ | 622 */ |
619 diffFile.open(outputFileName.c_str()); | 623 diffFile.open(outputFileName.c_str()); |
620 } | 624 } |
621 | 625 |
622 void testApp::loadRWCfileNumber(const int& i){ | 626 void testApp::loadRWCfileNumber(const int& i){ |
623 if (i >= 1 && i <= 64){ | 627 if (i >= 0 && i <= 64){ |
624 midiFileNumber = i; | 628 /*midiFileNumber = i; |
625 if (i >= 10) | 629 if (i >= 10) |
626 midiFileName = root + ofToString(midiFileNumber)+".MID"; | 630 midiFileName = root + ofToString(midiFileNumber)+".MID"; |
627 else | 631 else |
628 midiFileName = root + "0"+ofToString(midiFileNumber)+".MID"; | 632 midiFileName = root + "0"+ofToString(midiFileNumber)+".MID"; |
629 | 633 */ |
630 printf("FILE:%s\n", midiFileName.c_str()); | 634 midiFileName = root + rwcFileNameStrings[i]+".MID"; |
635 printf("MIDI FILE:%s\n", midiFileName.c_str()); | |
631 cannamMainFunction(); | 636 cannamMainFunction(); |
632 } | 637 } |
633 } | 638 } |
634 | 639 |
635 std::string testApp::makeRWCfilename(std::string& root, const int& fileID, std::string& endPart){ | 640 std::string testApp::makeRWCfilename(std::string& root, const int& fileID, std::string& endPart){ |
636 std::string pathName; | 641 std::string pathName; |
637 if (fileID >= 1 && fileID <= 64){ | 642 if (fileID >= 0 && fileID <= 64){ |
638 | 643 |
644 pathName = root + rwcFileNameStrings[fileID]+endPart; | |
645 /* | |
639 if (fileID >= 10) | 646 if (fileID >= 10) |
640 pathName = root + ofToString(fileID)+endPart; | 647 pathName = root + ofToString(fileID)+endPart; |
641 else | 648 else |
642 pathName = root + "0"+ofToString(fileID)+endPart; | 649 pathName = root + "0"+ofToString(fileID)+endPart; |
643 | 650 */ |
644 printf("MAKE FILE:%s\n", midiFileName.c_str()); | 651 printf("MAKE FILE:%s\n", midiFileName.c_str()); |
645 } | 652 } |
646 return pathName; | 653 return pathName; |
654 } | |
655 | |
656 void testApp::createRWCfilenameStrings(){ | |
657 rwcFileNameStrings.clear(); | |
658 for (int i = 1;i< 10;i++){ | |
659 rwcFileNameStrings.push_back("0"+ofToString(i)); | |
660 } | |
661 for (int i = 10;i< 23;i++){ | |
662 rwcFileNameStrings.push_back(ofToString(i)); | |
663 } | |
664 rwcFileNameStrings.push_back("23A"); | |
665 rwcFileNameStrings.push_back("23B"); | |
666 rwcFileNameStrings.push_back("23C"); | |
667 rwcFileNameStrings.push_back("23D"); | |
668 rwcFileNameStrings.push_back("23E"); | |
669 | |
670 rwcFileNameStrings.push_back("24A"); | |
671 rwcFileNameStrings.push_back("24B"); | |
672 rwcFileNameStrings.push_back("24C"); | |
673 | |
674 rwcFileNameStrings.push_back("25A"); | |
675 rwcFileNameStrings.push_back("25B"); | |
676 rwcFileNameStrings.push_back("25C"); | |
677 rwcFileNameStrings.push_back("25D"); | |
678 | |
679 for (int i = 26;i< 35;i++){ | |
680 rwcFileNameStrings.push_back(ofToString(i)); | |
681 } | |
682 rwcFileNameStrings.push_back("35A"); | |
683 rwcFileNameStrings.push_back("35B"); | |
684 rwcFileNameStrings.push_back("35C"); | |
685 for (int i = 36;i< 51;i++){ | |
686 rwcFileNameStrings.push_back(ofToString(i)); | |
687 } | |
688 | |
689 // for (int i = 0;i < rwcFileNameStrings.size();i++) { | |
690 // printf("RWC{%i}:'%s'\n", i, rwcFileNameStrings[i].c_str()); | |
691 // } | |
692 | |
647 } | 693 } |
648 | 694 |
649 void testApp::loadAnnotation(const int& fileID){ | 695 void testApp::loadAnnotation(const int& fileID){ |
650 string annotationRoot = "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C0"; | 696 string annotationRoot = "/Users/andrew/Documents/work/MuseScore/RWC/ANNOTATION/RM-C0"; |
651 string annotationEnding = "_annotation+WavPos.csv"; | 697 string annotationEnding = "_annotation+WavPos.csv"; |