Question about "MessageReceived" filtering

Started by Phil75,

Phil75

Hello  :)

Below is my code to receive MIDI-in messages :

Private Sub DeviceMidiIn_MessageReceived(sender As Object, e As MidiMessageEventArgs)
        If e.IsSysExMessage = False Then
            If e.ShortMessage.MessageType <> MIDIMessageType.SystemRealtime Then
                If e.IsShortMessage = True Then
...
                End If
            End If
        End If
End Sub

Is it possible to know if the received message is a "NoteOn" message?
I would like my code to only react to "NoteOn" messages.

Ian @ un4seen

I haven't used that stuff myself, so I'm not certain, but it looks like you would want to check if "e.ShortMessage.StatusType" is "MIDIStatus.NoteOn" (perhaps "MIDIStatus.NoteOff" too).

Private Sub DeviceMidiIn_MessageReceived(sender As Object, e As MidiMessageEventArgs)
        If e.IsShortMessage = True Then
            If e.ShortMessage.StatusType = MIDIStatus.NoteOn Then
...
            End If
        End If
End Sub