void Loop::cleanZeroLengthNotes() { Array<int> matchedNoteOffs; for (int i=0;i<getNumEvents();i++) { if (getEventPointer(i)->message.isNoteOn()) { if (getEventTime(i) == getTimeOfMatchingKeyUp(i) || getTimeOfMatchingKeyUp(i)==0.0) { //zero length note deleteEvent(i,(getTimeOfMatchingKeyUp(i)!=0.0)); updateMatchedPairs(); } } } for (int i=0;i<getNumEvents();i++) { if (getEventPointer(i)->message.isNoteOn() && getIndexOfMatchingKeyUp(i)!=-1) matchedNoteOffs.add(getIndexOfMatchingKeyUp(i)); } for (int i=0;i<getNumEvents();i++) { if (getEventPointer(i)->message.isNoteOff() && !matchedNoteOffs.contains(i)) { //unmatched note-off deleteEvent(i,false); updateMatchedPairs(); break; } } //updateMatchedPairs(); }
MidiMessageSequence::MidiMessageSequence (const MidiMessageSequence& other) { list.addCopiesOf (other.list); updateMatchedPairs(); }