Изменение громкости звуков в Windows


uses MMSystem;  
  
function GetWaveVolume: DWord;  
var Woc : TWaveOutCaps;  
    Volume : DWord;  
begin  
  result:=0;  
  if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) =  
       MMSYSERR_NOERROR then begin  
    if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then begin  
      WaveOutGetVolume(WAVE_MAPPER, @Volume);  
      Result := Volume;  
    end;  
  end;   
end;  
  
procedure SetWaveVolume(const AVolume: DWord);  
var Woc : TWaveOutCaps;  
begin  
  if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) =  
       MMSYSERR_NOERROR then begin  
    if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then  
      WaveOutSetVolume(WAVE_MAPPER, AVolume);  
  end;  
end;  
  
procedure TForm1.Button1Click(Sender: TObject);  
begin  
  Beep;  
end;  
  
procedure TForm1.Button2Click(Sender: TObject);  
var LeftVolume: Word;  
    RightVolume: Word;  
begin  
  LeftVolume := StrToInt(Edit1.Text);  
  RightVolume := StrToInt(Edit2.Text);  
  SetWaveVolume(MakeLong(LeftVolume, RightVolume));  
end;  
  
procedure TForm1.Button3Click(Sender: TObject);  
begin  
  Caption := IntToStr(GetWaveVolume);  
end;  
Теги:
Изменение громкости
Добавлено: 31 Июля 2018 07:28:27 Добавил: Андрей Ковальчук Нравится 0
Добавить
Комментарии:
Нету комментариев для вывода...