unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, MmSystem, StdCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure GetWaveOutDevicesInfo(DeviceNames: TStrings);
var
DNum: Integer;
i: Integer;
Caps: TWaveOutCaps;
begin
DNum := waveOutGetNumDevs;
// Number of Devices
for i := 0
to DNum - 1
do begin
ZeroMemory(@Caps, SizeOf(TWaveOutCaps));
waveOutGetDevCaps(i, @Caps, SizeOf(TWaveOutCaps));
DeviceNames.Add(Format('
Device %d/%d information follows...', [i,DNum-1] ));
DeviceNames.Add(
string(Caps.szPname));
DeviceNames.Add('
----------------------------------');
end;
end;
procedure GetWaveOutVolumeInfo(logInfo: TStrings);
var
DNum: Integer;
i: integer;
WaveOutCaps: TWaveOutCaps;
Volume: dword;
bolError: boolean;
wLVol: word;
wRVol: word;
begin
DNum := waveOutGetNumDevs;
// Number of Devices
for i := 0
to DNum - 1
do begin
bolError := True;
ZeroMemory(@WaveOutCaps, SizeOf(TWaveOutCaps));
Volume:=0;
if WaveOutGetDevCaps(i, @WaveOutCaps, SizeOf(WaveOutCaps)) = MMSYSERR_NOERROR
then if WaveOutCaps.dwSupport
and WAVECAPS_VOLUME = WAVECAPS_VOLUME
then begin
bolError :=
not WaveOutGetVolume(i, @Volume) = MMSYSERR_NOERROR;
wLVol := HiWord(volume);
wRVol := LoWord(volume);
end;
if not bolError
then logInfo.Add(Format('
(%d) %d - %d',[i, wLVol, wRVol]))
else logInfo.Add(Format('
(%d) - no volume info',[i]));
logInfo.Add('
----------------------------------');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Clear;
GetWaveOutDevicesInfo(Memo1.Lines);
GetWaveOutVolumeInfo(Memo1.Lines);
end;
end.