public static string GetDeviceName(int id) { MidiOutCaps caps = new MidiOutCaps(); caps.Name = new char[32]; int result = NativeMethods.midiOutGetDevCaps(id, ref caps, (uint)Marshal.SizeOf(caps)); int len = 0; for (int i = 0; i < 32; i++) { if (caps.Name[i] == 0) { len = i; break; } } return(new string(caps.Name, 0, len)); }
internal static extern int midiOutGetDevCaps( int uDeviceID, ref MidiOutCaps caps, uint cbMidiOutCaps);
public static string GetDeviceName(int id) { var caps = new MidiOutCaps(); caps.Name = new char[32]; var result = NativeMethods.midiOutGetDevCaps(id, ref caps, (uint)Marshal.SizeOf(caps)); var len = 0; for (var i = 0; i < 32; i++) { if (caps.Name[i] == 0) { len = i; break; } } return new string(caps.Name, 0, len); }