...get the names of all MIDI out devices?

Author: Ulli Conrad

Category: Multimedia

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;

 

printed from
www.swissdelphicenter.ch
developers knowledge base