I dont know if this is the smartest move
VolSplit.vLeft = VolSplit.vLeft + iValue
VolSplit.vRight = VolSplit.vRight + iValue
because you dont know the current states of the vleft and vright, one could be overflowing positivly and the other can be overflowing negitively..... I would bypass this completly
This changes your WAV volume settings. But be careful because it seems that it will loop through max and min volume, so if you keep making it quieter eventually it will start back at the top.Code:Option Explicit 'Types Private Type tVolume Volume As Long End Type Private Type tVolumeEx vLeft As Integer vRight As Integer End Type 'Declares Private Declare Function waveOutGetVolume Lib "winmm.dll" _ (ByVal uDeviceID As Long, lpdwVolume As Long) As Long Private Declare Function waveOutSetVolume Lib "winmm.dll" _ (ByVal uDeviceID As Long, ByVal dwVolume As Long) As Long Sub ChangeVolume(iValue As Single) Dim DeviceID As Long Dim ActVolume As Long Dim Vol As tVolume Dim VolSplit As tVolumeEx 'The wave level DeviceID = -0 'Get current volume waveOutGetVolume DeviceID, ActVolume Vol.Volume = ActVolume Label1.Caption = ActVolume 'Split to stereo channels '(Long >> 2x Int) LSet VolSplit = Vol 'Change volume ActVolume = ActVolume + iValue 'Apply new volume waveOutSetVolume DeviceID, ActVolume End Sub Private Sub cmdDecrease_Click() ChangeVolume -2024 End Sub Private Sub cmdIncrease_Click() ChangeVolume 2024 End Sub
I havent played with this stuff in a while, so i dont remember too much about the volume API calls, but this might help you a little bit.



LinkBack URL
About LinkBacks

Reply With Quote


Bookmarks