Google

Friday, March 16, 2007

get the names of all MIDI out devices

procedure GetMIDIOutDevices(Devices: TStrings);
var
i, DNum: Integer;
Caps: TMIDIOUTCAPSA;
begin
DNum := MIDIOutGetNumDevs; // Number of Devices
for i := 0 to DNum - 1 do // Query Devicenames
begin
MIDIOutGetDevCaps(i, @Caps, SizeOf(TMIDIOutCapsA));
Devices.Add(string(Caps.szPname));
end;
end;

// Usage:

var
MIDIDevices: TStringList;

begin
MIDIDevices := TStringList.Create;
try
GetMIDIOutDevices(MIDIDevices);
// Do anything with the device name list
finally
MIDIDevices.Free;
end;
end;

No comments: