Author: Tomas Rutkauskas How to get and set the volume on a wave device Answer: Here are a couple of functions for getting/ setting the volume on the default wave device: 1 uses 2 mmsystem; 3 4 function GetWaveVolume: DWord; 5 var 6 Woc: TWAVEOUTCAPS; 7 Volume: DWord; 8 begin 9 if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then 10 if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then 11 begin 12 WaveOutGetVolume(WAVE_MAPPER, @Volume); 13 Result := Volume; 14 end; 15 end; 16 17 procedure SetWaveVolume(const AVolume: DWord); 18 var 19 Woc: TWAVEOUTCAPS; 20 begin 21 if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then 22 if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then 23 WaveOutSetVolume(WAVE_MAPPER, AVolume); 24 end; 25 26 27 //Here's how they might be used: 28 29 30 procedure TForm1.Button2Click(Sender: TObject); 31 var 32 LeftVolume: Word; 33 RightVolume: Word; 34 begin 35 LeftVolume := StrToInt(Edit1.Text); 36 RightVolume := StrToInt(Edit2.Text); 37 SetWaveVolume(MakeLong(LeftVolume, RightVolume)); 38 end; 39 40 procedure TForm1.Button3Click(Sender: TObject); 41 begin 42 Caption := IntToStr(GetWaveVolume); 43 end;