/// <summary> /// 指定されたMIDI出力ポートの情報を取得します。 /// </summary> internal static MidiOutCapsA GetPortInformation( int portNum ) { var caps = new MidiOutCapsA (); MidiOutApi.midiOutGetDevCapsA ( (uint)portNum, ref caps, (uint)Marshal.SizeOf ( typeof ( MidiOutCapsA ) ) ).Throw (); return caps; }
internal static extern MMResult midiOutGetDevCapsA( [MarshalAs ( UnmanagedType.U4 )] uint uDeviceID, ref MidiOutCapsA pMidiOutCaps, [MarshalAs ( UnmanagedType.U4 )] uint cbMidiOutCaps );
/// <summary> /// 実行環境のMIDIポートの情報をすべて取得します /// </summary> /// <returns></returns> internal static List<MidiOutCapsA> GetPortInformations() { int portCount = GetPortCount (); List<MidiOutCapsA> retValue = new List<MidiOutCapsA> (); for ( int i = 0; i < portCount; i++ ) { var caps = new MidiOutCapsA (); MidiOutApi.midiOutGetDevCapsA ( (uint)i, ref caps, (uint)Marshal.SizeOf ( typeof ( MidiOutCapsA ) ) ).Throw (); retValue.Add ( caps ); } return retValue; }