Board index » delphi » D1 Changing the sound volume

D1 Changing the sound volume

I want to change the sound volume by using a scroll bar.
I use a few wave-files in my program and I can not find a way to do
this.
Who can help. Please notice: I use Delphi 1. So SetWaveVolume or
whatever the name of the function/method is, is of no use to me.

Can you help...Thanks in advance

 

Re:D1 Changing the sound volume


In article <5nv53n$h...@news.utrecht.NL.net>, Robert Christiaanse
<tyc...@highway.nl> writes

Quote
>I want to change the sound volume by using a scroll bar.
>I use a few wave-files in my program and I can not find a way to do
>this.
>Who can help. Please notice: I use Delphi 1. So SetWaveVolume or
>whatever the name of the function/method is, is of no use to me.

The waveOutSetVolume procedure is the only way I've found of adjusting
volume, the technique works under Delphi 1.
This code should do the trick.

procedure SetVolume(volumeL, volumeR : word);   { Volume 0% ---> 100% }
var SetVol : longint;
begin
     volumeL := ($FFFF div 100) * volumeL;
     volumeR := ($FFFF div 100) * volumeR;

     SetVol := (volumeL * 65536) + volumeR;      

     waveOutSetVolume(MediaPlayer.DeviceID - 1, SetVol);
end;

Quote

--
Dave McConnell

Other Threads