public void MidiEvent(MidiEvent midiEvent) { if (!NoteInputMode.IsMidi()) { return; } if (midiEvent.IsNoteOn()) { var pitch = MidiPitchMapping.Map(midiEvent.Cast <NoteEvent>()); NoteSink.NoteOn(pitch); } else if (midiEvent.IsNoteOff()) { var pitch = MidiPitchMapping.Map(midiEvent.Cast <NoteEvent>()); NoteSink.NoteOff(pitch); } }