private void Callback(IntPtr midiInHandle, MidiInterop.MidiOutMessage message, IntPtr userData, IntPtr messageParameter1, IntPtr messageParameter2) { }
private void Callback(IntPtr midiInHandle, MidiInterop.MidiInMessage message, IntPtr userData, IntPtr messageParameter1, IntPtr messageParameter2) { switch(message) { case MidiInterop.MidiInMessage.Open: // message Parameter 1 & 2 are not used break; case MidiInterop.MidiInMessage.Data: // parameter 1 is packed MIDI message // parameter 2 is milliseconds since MidiInStart if (MessageReceived != null) { MessageReceived(this, new MidiInMessageEventArgs(messageParameter1.ToInt32(), messageParameter2.ToInt32())); } break; case MidiInterop.MidiInMessage.Error: // parameter 1 is invalid MIDI message if (ErrorReceived != null) { ErrorReceived(this, new MidiInMessageEventArgs(messageParameter1.ToInt32(), messageParameter2.ToInt32())); } break; case MidiInterop.MidiInMessage.Close: // message Parameter 1 & 2 are not used break; case MidiInterop.MidiInMessage.LongData: // parameter 1 is pointer to MIDI header // parameter 2 is milliseconds since MidiInStart break; case MidiInterop.MidiInMessage.LongError: // parameter 1 is pointer to MIDI header // parameter 2 is milliseconds since MidiInStart break; case MidiInterop.MidiInMessage.MoreData: // parameter 1 is packed MIDI message // parameter 2 is milliseconds since MidiInStart break; } }