Exemple #1
0
        public void SendBuffer(byte[] byteBuffer)
        {
            MidiInterop.MIDIHDR mIDIHDR = default(MidiInterop.MIDIHDR);
            mIDIHDR.lpData = Marshal.AllocHGlobal(byteBuffer.Length);
            Marshal.Copy(byteBuffer, 0, mIDIHDR.lpData, byteBuffer.Length);
            mIDIHDR.dwBufferLength  = byteBuffer.Length;
            mIDIHDR.dwBytesRecorded = byteBuffer.Length;
            int uSize = Marshal.SizeOf(mIDIHDR);

            MidiInterop.midiOutPrepareHeader(this.hMidiOut, ref mIDIHDR, uSize);
            if (MidiInterop.midiOutLongMsg(this.hMidiOut, ref mIDIHDR, uSize) != MmResult.NoError)
            {
                MidiInterop.midiOutUnprepareHeader(this.hMidiOut, ref mIDIHDR, uSize);
            }
            Marshal.FreeHGlobal(mIDIHDR.lpData);
        }
Exemple #2
0
 public static extern MmResult midiInAddBuffer(IntPtr hMidiIn, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR lpMidiInHdr, int uSize);
Exemple #3
0
 public static extern MmResult midiStreamOut(IntPtr hMidiStream, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR pmh, int cbmh);
Exemple #4
0
 public static extern MmResult midiOutUnprepareHeader(IntPtr hMidiOut, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR lpMidiOutHdr, int uSize);