这是我的程序中的一个片段,用来设置和得到左右声道音量.
procedure TSrwVolume.SetVolume(left,right:integer);
var leftv,rightv:integer;
begin
leftv:=left;
rightv:=right;
mmsystem.waveOutSetVolume(0,leftv+rightv*65536);
end;
procedure TSrwVolume.GetLeftVolume;
var allvolume,leftv,rightv:integer;
begin
waveoutgetvolume(0,@allvolume);
leftv:=allvolume and $0ffff;
rightv:=(allvolume and $0ffff0000) div $10000;
FTempLeft:=leftv;
FTempRight:=rightv;
end;
procedure TSrwVolume.GetRightVolume;
var allvolume,leftv,rightv:integer;
begin
waveoutgetvolume(0,@allvolume);
leftv:=allvolume and $0ffff;
rightv:=(allvolume and $0ffff0000) div $10000;
FTempLeft:=leftv;
FTempRight:=rightv;
end;