Mp3 Volume Adjuster Program
Keywords: Mp3 Volume Adjuster waveOutGetVolume waveOutSetVolume
volume control sound level
Here's a snippet I used for my automatic mp3 volume adjuster program.
It gets and sets the WAVE volume, not the overall volume, but might
give you a step in the right direction. I'm way too busy or I'd
happily adjust my code to use the main volume. (I turned it into a
quick example, 500 isn't a huge volume adjustment when it can go up to
32768.)
DaDll=strcat(DirWindows(1),"WINMM.DLL")
bin1 = BinaryAlloc(4)
Gosub GetVolume
Message(LeftVolumeAmount, RightVolumeAmount)
LeftVolumeAmount = LeftVolumeAmount + 500
RightVolumeAmount = RightVolumeAmount - 500
Message(LeftVolumeAmount, RightVolumeAmount)
Gosub SetVolume
EXIT
****************************GetVolume******************************************
:GetVolume
WaveErr = DllCall(DaDll, long:"waveOutGetVolume",long:0,
lpbinary:bin1)
if WaveErr != 0
Message("error in waveOutGetVolume:", WaveErr)
exit
endif
BinaryEODSet(bin1, 4)
LeftVolumeAmount = BinaryPeek2(bin1,0)
RightVolumeAmount = BinaryPeek2(bin1,2)
RETURN
****************************SetVolume******************************************
:SetVolume
TempLeftVolumeAmount = LeftVolumeAmount
TempRightVolumeAmount = RightVolumeAmount
;;Gosub AdjustBalance
BinaryPoke2(bin1, 0, TempLeftVolumeAmount)
BinaryPoke2(bin1, 2, TempRightVolumeAmount)
NewVolume = BinaryPeek4(bin1, 0)
WaveErr = DllCall(DaDll, long:"waveOutSetVolume",long:0,
long:NewVolume)
if WaveErr != 0
Message("error in waveOutSetVolume:", WaveErr)
exit
endif
RETURN
*******************************************************************************
Article ID: W14734
Filename: Mp3 Volume Adjuster Program.txt