Message-ID: <3BCCAE47.242F9972@borland.newsgroups> Date: Wed, 17 Oct 2001 08:01:43 +1000 From: Charles Hacker X-Mailer: Mozilla 4.77 [en] (Win95; U) X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: borland.public.delphi.database.desktop,borland.public.delphi.graphics,borland.public.delphi.objectpascal,borland.public.delphi.thirdparty-tools,borland.public.delphi.upgrade,borland.public.delphi.vcl.components.writing,borland.public.delphi.winapi Subject: Re: Volume control References: <3bccaa07_1@dnews> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 132.234.46.2 X-Trace: dnews 1003269712 132.234.46.2 (16 Oct 2001 15:01:52 -0700) Lines: 54 Path: dnews Xref: dnews borland.public.delphi.database.desktop:130733 borland.public.delphi.graphics:42825 borland.public.delphi.objectpascal:210342 borland.public.delphi.thirdparty-tools:50285 borland.public.delphi.upgrade:2721 borland.public.delphi.vcl.components.writing:44233 borland.public.delphi.winapi:149536 Marco Branco wrote: > > 1 - How could i control both left and right volume independently? > 2 - How could i control the main volume buton to both sides (right and left uses mmsystem; function GetWaveVolume: DWord; var Woc : TWAVEOUTCAPS; Volume : DWord; begin if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then begin WaveOutGetVolume(WAVE_MAPPER, @Volume); Result := Volume; end; end; procedure SetWaveVolume(const AVolume: DWord); var Woc : TWAVEOUTCAPS; begin if WaveOutGetDevCaps(WAVE_MAPPER, @Woc, sizeof(Woc)) = MMSYSERR_NOERROR then if Woc.dwSupport and WAVECAPS_VOLUME = WAVECAPS_VOLUME then WaveOutSetVolume(WAVE_MAPPER, AVolume); end; Here's how they might be used: 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; -- Charles Hacker Lecturer in Electronics and Computing School of Engineering Griffith University - Gold Coast Australia