Beispiel #1
0
        private bool IsNoteOffEvent(NoteEvent noteEvent)
        {
            if(noteEvent == null)
            {
                throw new NullReferenceException("Note event cannot be null");
            }

            return noteEvent.CommandCode == MIDICommandCodes.NoteOff ||
                (noteEvent.CommandCode == MIDICommandCodes.NoteOn && noteEvent.Velocity == 0);
        }
Beispiel #2
0
 private void FindNoteOn(NoteEvent offEvent, List<NoteOnEvent> outstandingNoteOnEvents)
 {
     bool found = false;
     foreach (NoteOnEvent noteOnEvent in outstandingNoteOnEvents)
     {
         if ((noteOnEvent.Channel == offEvent.Channel) && (noteOnEvent.NoteNumber == offEvent.NoteNumber))
         {
             noteOnEvent.OffEvent = offEvent;
             outstandingNoteOnEvents.Remove(noteOnEvent);
             found = true;
             break;
         }
     }
 }
        private void PairWithNoteOnEvent(NoteEvent offEvent)
        {
            foreach (NoteOnEvent noteOnEvent in _outstandingNoteOnEvents)
            {
                if ((noteOnEvent.Channel == offEvent.Channel) && (noteOnEvent.NoteNumber == offEvent.NoteNumber))
                {
                    noteOnEvent.OffEvent = offEvent;
                    _outstandingNoteOnEvents.Remove(noteOnEvent);

                    break;
                }
            }
        }