示例#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);
        }
示例#2
0
 public static extern MmResult midiInAddBuffer(IntPtr hMidiIn, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR lpMidiInHdr, int uSize);
示例#3
0
 public static extern MmResult midiStreamOut(IntPtr hMidiStream, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR pmh, int cbmh);
示例#4
0
 public static extern MmResult midiOutUnprepareHeader(IntPtr hMidiOut, [MarshalAs(UnmanagedType.Struct)] ref MidiInterop.MIDIHDR lpMidiOutHdr, int uSize);