Mercurial > hg > midi-score-follower
comparison jnmr/midiEventHolder.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 | 5685ef75550c |
comparison
equal
deleted
inserted
replaced
37:795a99987875 | 38:c3d32207565f |
---|---|
15 #include <iostream> | 15 #include <iostream> |
16 #include <fstream> | 16 #include <fstream> |
17 | 17 |
18 midiEventHolder::midiEventHolder(){ | 18 midiEventHolder::midiEventHolder(){ |
19 | 19 |
20 myNotation.readInSomeValues(); | 20 |
21 | 21 |
22 // recordedNoteOnIndex = 0; | 22 // recordedNoteOnIndex = 0; |
23 alignmentPosition = 0; | 23 alignmentPosition = 0; |
24 | 24 |
25 useTempoPrior = false;//puts sine wave round tempo | 25 useTempoPrior = false;//puts sine wave round tempo |
809 | 809 |
810 | 810 |
811 | 811 |
812 while (smoothIndex < recordedEventTimes.size() && recordedEventTimes[smoothIndex] < newPosition){ | 812 while (smoothIndex < recordedEventTimes.size() && recordedEventTimes[smoothIndex] < newPosition){ |
813 float annotationTime = 0; | 813 float annotationTime = 0; |
814 float annotationLocation = 0; | |
814 int annotationNote = 0; | 815 int annotationNote = 0; |
815 if (smoothIndex < myNotation.rwcAnnotations.size()){ | 816 if (smoothIndex < myNotation.rwcAnnotations.size()){ |
816 annotationTime = myNotation.rwcAnnotations[smoothIndex].eventTime; | 817 annotationTime = myNotation.rwcAnnotations[smoothIndex].eventTime; |
817 annotationNote = myNotation.rwcAnnotations[smoothIndex].midiNote; | 818 annotationNote = myNotation.rwcAnnotations[smoothIndex].midiNote; |
819 annotationLocation = myNotation.rwcAnnotations[smoothIndex].beatLocation; | |
818 } | 820 } |
819 | 821 |
820 float difference = playingTime - (annotationTime*1000.0); | 822 float difference = playingTime - (annotationTime*1000.0); |
821 | 823 |
822 if ((*fileOutput).is_open()){ | 824 if ((*fileOutput).is_open()){ |
826 if ( recordedNoteOnMatrix[smoothIndex][1] == annotationNote){ | 828 if ( recordedNoteOnMatrix[smoothIndex][1] == annotationNote){ |
827 (*fileOutput) << " corresponds to " << annotationTime; | 829 (*fileOutput) << " corresponds to " << annotationTime; |
828 } | 830 } |
829 (*fileOutput) << " \n"; | 831 (*fileOutput) << " \n"; |
830 | 832 |
831 printf("midi %i beat pos %f now at %f :: annotaion %i time %f diff \t%f ms\n", recordedNoteOnMatrix[smoothIndex][1], | 833 |
832 beatPositions[smoothIndex], playingTime, annotationNote, annotationTime, difference); | |
833 | 834 |
834 } | 835 } |
835 | 836 |
836 if ((*differenceOutput).is_open()){ | 837 if ((*differenceOutput).is_open()){ |
837 (*differenceOutput) << beatPositions[smoothIndex] << "," << difference << "\n"; | 838 (*differenceOutput) << beatPositions[smoothIndex] << "," << difference << "\n"; |
839 printf("midi %i beat pos %f now at %f :: annotaion %i loc % f time %f diff \t%f ms\n", recordedNoteOnMatrix[smoothIndex][1], | |
840 beatPositions[smoothIndex], playingTime, | |
841 annotationNote, annotationLocation, annotationTime, difference); | |
838 } | 842 } |
839 | 843 |
840 smoothIndex++; | 844 smoothIndex++; |
841 } | 845 } |
842 | 846 |