Mercurial > hg > midi-score-follower
diff src/CannamMidiFileLoader.cpp @ 16:f0abb0e414ec
reorders the MIDI matrix once loaded from all channels, chop the beginning now less relevant - check how this might work...
author | Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk> |
---|---|
date | Tue, 15 Nov 2011 19:35:05 +0000 |
parents | 3f103cf78148 |
children | d75d16c57eac |
line wrap: on
line diff
--- a/src/CannamMidiFileLoader.cpp Tue Nov 15 13:10:12 2011 +0000 +++ b/src/CannamMidiFileLoader.cpp Tue Nov 15 19:35:05 2011 +0000 @@ -11,7 +11,7 @@ #include "CannamMidiFileLoader.h" CannamMidiFileLoader::CannamMidiFileLoader(){ - chopBeginning = true; + chopBeginning = false; } int CannamMidiFileLoader::loadFile(std::string& filename, midiEventHolder& myMidiEvents){ @@ -154,7 +154,6 @@ if (noteOnIndex == 0){ - firstNoteTime = myMidiEvents.getEventTimeMillis(t); firstTickTime = t; } @@ -172,13 +171,6 @@ v.push_back(j->getDuration()); myMidiEvents.recordedNoteOnMatrix.push_back(v); - if (!chopBeginning) - myMidiEvents.recordedEventTimes.push_back(myMidiEvents.getEventTimeMillis(t)); - else { - myMidiEvents.recordedEventTimes.push_back(myMidiEvents.getEventTimeMillis(t) - firstNoteTime); - // printf("chopping beginning %f \n", myMidiEvents.getEventTimeMillis(t) - firstNoteTime); - } - myMidiEvents.noteOnMatches.push_back(false); break; @@ -251,10 +243,29 @@ } + + myMidiEvents.printRecordedEvents(); + printf("|||||||||||||||||||||| \n\n\n\n\n\n\n"); + myMidiEvents.reorderMatrixFromNoteTimes(myMidiEvents.recordedNoteOnMatrix); + myMidiEvents.correctTiming(myMidiEvents.recordedNoteOnMatrix); + + + long t; + t = myMidiEvents.recordedNoteOnMatrix[0][0]; + firstNoteTime = myMidiEvents.getEventTimeMillis(t); + + for (int i = 0; i < myMidiEvents.recordedNoteOnMatrix.size();i++){ + t = myMidiEvents.recordedNoteOnMatrix[i][0]; + if (!chopBeginning) + myMidiEvents.recordedEventTimes.push_back(myMidiEvents.getEventTimeMillis(t)); + else { + myMidiEvents.recordedEventTimes.push_back(myMidiEvents.getEventTimeMillis(t) - firstNoteTime); - - + } + } + myMidiEvents.printRecordedEvents(); + }//end cannam midi main