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