this slowpoke moves

Adjust Volume of Audio in Devices

uses MMSystem

//

function GetLineInHandle(AudioType: Integer): Integer;
var
  i: Integer;
  AudioCaps: TAuxCaps;
begin
  Result := 0;
  for i := 0 to auxGetNumDevs - 1 do
  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
  // Get audio from internal CD-ROM drive
  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
  // Set audio from internal CD-ROM drive
  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
  // Get audio from auxiliary input jacks
  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
  // Set audio from auxiliary input jacks
  v := MakeLong(Word(StrToInt(Edit3.Text)),
    Word(StrToInt(Edit4.Text)));
  AuxSetVolume(GetLineInHandle(AUXCAPS_AUXIN), v);
end;

Keine Kommentare:

Kommentar veröffentlichen

Beliebte Posts

Translate