볼륨조절함수
MMRESULT waveOutSetVolume( HWAVEOUT hwo, DWORD dwVolume );

Parameters

hwo

Handle to an open waveform-audio output device.

This parameter can also be a device identifier.

dwVolume

New volume setting.

The low-order word contains the left-channel volume setting,

and the high-order word contains the right-channel setting.

A value of 0xFFFF represents full volume, and a value of 0x0000 is silence.

If a device does not support both left and right volume control,

the low-order word of dwVolume specifies the volume level,

and the high-order word is ignored.

 

Return Values

Returns MMSYSERR_NOERROR if successful or an error otherwise.

Possible error values include the following.

ValueDescription
MMSYSERR_INVALHANDLESpecified device handle is invalid.
MMSYSERR_NODRIVERNo device driver is present.
MMSYSERR_NOMEMUnable to allocate or lock memory.
MMSYSERR_NOTSUPPORTEDFunction is not supported.
 

 

 

uses MMSystem;

 

 

...

...

...

 

 

var

  원래볼륨: DWORD;

 

 

// 시작할 때 원래 볼륨 저장

procedure TForm1.FormCreate(Sender: TObject);

begin

  waveOutGetVolume(0, @원래볼륨);

end;

 

 

// 볼륨 조절 함수

procedure SetVolume(NewVolume: DWORD);
begin
  NewVolume:=MAKEWPARAM(NewVolume, NewVolume);
  waveOutSetVolume(0, NewVolume);
end;

 

 

// Mute

procedure TForm1.btnMuteClick(Sender: TObject);

begin

  SetVolume(0); 

end;

 

 

// Mute 해제

procedure TForm1.btnRestoreVolumeClick(Sender: TObject);

begin

  SetVolume(원래볼륨);

end;









Posted by bloodguy
,