コード例 #1
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public void shutdown()
        {
            if (!virtualMIDIShutdown(fInstance))
            {
                int lastError = Marshal.GetLastWin32Error();

                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }
        }
コード例 #2
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public void sendCommand(byte[] command)
        {
            if ((command == null) || (command.Length == 0))
            {
                return;
            }

            if (!virtualMIDISendData(fInstance, command, (UInt32)command.Length))
            {
                int lastError = Marshal.GetLastWin32Error();
                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }
        }
コード例 #3
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public TeVirtualMIDI(string portName, UInt32 maxSysexLength, UInt32 flags, ref Guid manufacturer, ref Guid product)
        {
            fInstance = virtualMIDICreatePortEx3(portName, IntPtr.Zero, IntPtr.Zero, maxSysexLength, flags, ref manufacturer, ref product);

            if (fInstance == IntPtr.Zero)
            {
                int lastError = Marshal.GetLastWin32Error();

                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }

            fReadBuffer     = new byte[maxSysexLength];
            fReadProcessIds = new UInt64[17];
            fMaxSysexLength = maxSysexLength;
        }
コード例 #4
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public TeVirtualMIDI(string portName, UInt32 maxSysexLength = TE_VM_DEFAULT_SYSEX_SIZE, UInt32 flags = TE_VM_FLAGS_PARSE_RX)
        {
            fInstance = virtualMIDICreatePortEx2(portName, IntPtr.Zero, IntPtr.Zero, maxSysexLength, flags);

            if (fInstance == IntPtr.Zero)
            {
                int lastError = Marshal.GetLastWin32Error();

                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }

            fReadBuffer     = new byte[maxSysexLength];
            fReadProcessIds = new UInt64[17];
            fMaxSysexLength = maxSysexLength;
        }
コード例 #5
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public byte[] getCommand()
        {
            UInt32 length = fMaxSysexLength;

            if (!virtualMIDIGetData(fInstance, fReadBuffer, ref length))
            {
                int lastError = Marshal.GetLastWin32Error();
                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }

            byte[] outBytes = new byte[length];

            Array.Copy(fReadBuffer, outBytes, length);

            return(outBytes);
        }
コード例 #6
0
ファイル: TeVirtualMidi.cs プロジェクト: gicanoi/MidiMapper
        public UInt64[] getProcessIds()
        {
            UInt32 length = 17 * sizeof(ulong);
            UInt32 count;

            if (!virtualMIDIGetProcesses(fInstance, fReadProcessIds, ref length))
            {
                int lastError = Marshal.GetLastWin32Error();
                TeVirtualMIDIException.ThrowExceptionForReasonCode(lastError);
            }

            count = length / sizeof(ulong);

            UInt64[] outIds = new UInt64[count];

            Array.Copy(fReadProcessIds, outIds, count);

            return(outIds);
        }