如果我的电脑有两个,我如何选择声卡来播放我的声音 声卡。 现在我正在使用:
procedure TForm_Principal.FormCreate(Sender: TObject);
var
DevOutCaps: TWaveOutCaps;
n, i:Integer;
s: String;
begin
Self.comboOut.Items.Clear;
n := waveOutGetNumDevs;
for i := 0 to n-1 do
begin
waveOutGetDevCaps(i, @DevOutCaps, SizeOf(DevOutCaps));
s := PChar(@DevOutCaps.szPname);
Self.comboOut.Items.Add(s);
end;
end;
然后:
procedure TForm_Principal.Button1Click(Sender: TObject);
var
Res: TResourceStream;
begin
Res := TResourceStream.Create(HInstance, 'Sound_Ringing', RT_RCDATA);
try
Res.Position := 0;
PlaySound(Res.Memory,
Self.comboOut.ItemIndex, SND_MEMORY or SND_ASYNC );
//SndPlaySound(Res.Memory, SND_MEMORY or SND_ASYNC or SND_LOOP);
finally
Res.Free;
end;
end;
它不起作用,任何人都可以帮助我? 谢谢。