private NoteEventPair GetNoteEventsBeforeTick(uint tick, MidiNoteFilter note) { NoteEventPair pair = null; foreach (var noteEventPair in midiTrack.NoteEventPairs) { if (noteEventPair.OnTick > tick) { break; } if (!note.Check(noteEventPair.onNoteEvent)) { continue; } pair = noteEventPair; } return(pair); }