如何控制麦克风的音量(50分)

  • 主题发起人 主题发起人 LeeChange
  • 开始时间 开始时间
L

LeeChange

Unregistered / Unconfirmed
GUEST, unregistred user!
如何对混音台的各个设备单独设置音量?
 
使用如下代码可调整MicroPhone的音量

uses
MMSystem;

function GetLineInHandle(AudioType : integer) : integer;
var
i : integer;
AudioCaps : TAuxCaps;
begin

result := 0;
for i := 0 to auxGetNumDevs - 1do
begin

auxGetDevCaps(i, @AudioCaps, sizeof(AudioCaps));
if AudioCaps.wTechnology = AudioType then
begin

Result := i;
Break;
end;

end;

end;


procedure TForm1.Button1Click(Sender: TObject);
var
v : DWORD;
begin

AuxGetVolume(GetLineInHandle(AUXCAPS_CDAUDIO), @v);
Edit1.Text := IntToStr(LoWord(v));
Edit2.Text := IntToStr(HiWord(v));
end;


procedure TForm1.Button2Click(Sender: TObject);
var
v : DWORD;
begin

v := MakeLong(Word(StrToInt(Edit1.Text)),
Word(StrToInt(Edit2.Text)));
AuxSetVolume(GetLineInHandle(AUXCAPS_CDAUDIO), v);
end;


procedure TForm1.Button3Click(Sender: TObject);
var
v : DWORD;
begin

AuxGetVolume(GetLineInHandle(AUXCAPS_AUXIN), @v);
Edit3.Text := IntToStr(LoWord(v));
Edit4.Text := IntToStr(HiWord(v));
end;


procedure TForm1.Button4Click(Sender: TObject);
var
v : DWORD;
begin

v := MakeLong(Word(StrToInt(Edit3.Text)),
Word(StrToInt(Edit4.Text)));
AuxSetVolume(GetLineInHandle(AUXCAPS_AUXIN), v);
end;


 
接受答案了.
 
后退
顶部