|
/// <summary> /// 4バイト以内のMIDIデータ(Short Message)を送信します。 /// </summary> /// <param name="data">送信するデータ。</param> void SendShortMsg(byte[] data) { byte[] sendData = new byte[4]; for (i = 0; i < data.Length; i++) { sendData[i] = data[i]; } int message = (sendData[3] << 24) | (sendData[2] << 16) | (sendData[1] << 8) | sendData[0]; midiOutShortMsg(systemHandle, message); } [DllImport("winmm.dll")] static extern int midiOutShortMsg(int hMidiOut, int dwMsg); |
|
''' <summary> ''' 4バイト以内のMIDIデータ(Short Message)を送信します。 ''' </summary> ''' <param name="data">送信するデータ。</param> Private Sub SendShortMsg(ByVal data As Byte()) Dim sendData As Byte() = New Byte(3) Dim i As Integer For i = 0 To data.Length - 1 sendData(i) = data(i) Next i Dim message As Integer = ((((sendData(3) << &H18) Or (sendData(2) << &H10)) Or (sendData(1) << 8)) Or sendData(0)) midiOutShortMsg(systemHandle, message) End Sub Declare Function midiOutShortMsg Lib "winmm" (ByVal hMidiOut As Integer, ByVal dwMsg As Integer) As Integer |
4バイト以内のMIDIメッセージは、ウィンドウメッセージとして直接送信します。
|
using NextMIDI; using NextMIDI.DataElement; using NextMIDI.MidiOutPort; MidiCC midiCC = new MidiCC(); // CH 1 Hold ON midiCC.CH = 0; midiCC.Number = 64; midiCC.Value = 127; midiOut.SendData(midiCC, 0); |
|
Imports NextMIDI Imports NextMIDI.DataElement Imports NextMIDI.MidiOutPort Dim myMidiCC As New MidiCC ' CH 1 Hold ON myMidiCC.CH = 0 myMidiCC.Number = 64 myMidiCC.Value = 127 myMidiOut.SendData(myMidiCC, 0) |