예제 #1
0
        private void GetOutNames()
        {
            Console.WriteLine("Out Devices: ");
            MidiOutCaps caps = new MidiOutCaps();

            for (int i = 0; i < WinMM.midiOutGetNumDevs(); i++)
            {
                WinMM.midiOutGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(MidiOutCaps)));
                Console.WriteLine(caps.name);
            }
        }
예제 #2
0
        private int GetOutIdByName(string deviceName)
        {
            MidiOutCaps caps     = new MidiOutCaps();
            int         deviceID = -1;
            int         num      = WinMM.midiOutGetNumDevs();

            for (int i = 0; i < num; i++)
            {
                WinMM.midiOutGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(MidiOutCaps)));
                if (caps.name == deviceName)
                {
                    deviceID = i;
                    break;
                }
            }
            if (deviceID == -1)
            {
                throw new Exception("Midi OUT device " + deviceName + " not found");
            }
            return(deviceID);
        }
예제 #3
0
 internal static extern int midiOutGetDevCaps(int deviceId, ref MidiOutCaps caps, int sizeOfMidiOutCaps);