Connaitre/Fixer le volume Wav

uses
MMSystem;

function GetWaveVolume: DWord;
var
WaveOutCaps: TWAVEOUTCAPS;
Volume: DWord;
begin
Result := 0;
if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, SizeOf(WaveOutCaps)) = MMSYSERR_NOERROR then
if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
begin
WaveOutGetVolume(WAVE_MAPPER, @Volume);
Result := Volume;
end;
end;

function SetWaveVolume( const AVolume: DWord): boolean;
var
WaveOutCaps: TWAVEOUTCAPS;
begin
Result := False;
if WaveOutGetDevCaps(WAVE_MAPPER, @WaveOutCaps, sizeof(WaveOutCaps)) = MMSYSERR_NOERROR then
if WaveOutCaps.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then
Result := WaveOutSetVolume(WAVE_MAPPER, AVolume) = MMSYSERR_NOERROR;
end;

// fixer le volume

procedure TForm1.Button1Click(Sender: TObject);
var
LeftVolume: Word;
RightVolume: Word;
begin
LeftVolume := SpinEdit1.Value; // max. is 65535
RightVolume := SpinEdit2.Value; // max. is 65535
SetWaveVolume(MakeLong(LeftVolume, RightVolume));
end;


//Connaître le volume

procedure TForm1.Button2Click(Sender: TObject);
begin
ShowMessage(IntToHex(GetWaveVolume, 8));
end;
Ajouter un commentaire
Pseudo
Adresse email
Site internet (optionnel)
Votre commentaire
Fiche de l'article
Mise a jour13/11/2001
VisualisationVu 1991 fois
PublicInternaute zz
CategorieDelphi - Trucs et astuces - Multimedia
Auteur de l'article
SwissDelphiCenter SwissDelphiCenter
connecté le 02/11/2011
329 articles dans la section
Contacter l'auteur