ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adjust Audio Volume (https://www.excelbanter.com/excel-programming/365049-adjust-audio-volume.html)

AP[_3_]

Adjust Audio Volume
 
How can I adjust audio volume (for wav, MIDI, mp3 files) from within Excel ?

What declarations and functions would I need ?

Thanks,
AP



Piotr Lipski

Adjust Audio Volume
 
On Thu, 22 Jun 2006 21:31:05 +1200, AP wrote:

How can I adjust audio volume (for wav, MIDI, mp3 files) from within Excel ?


For wav:

Declare Function waveOutSetVolume Lib "Winmm" (ByVal wDeviceID As Integer,
ByVal dwVolume As Long) As Integer
Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer,
dwVolume As Long) As Integer

Public Function GetVolume()
Dim a, i As Long
Dim tmp As String
a = waveOutGetVolume(0, i)
tmp = "&h" & Right(Hex$(i), 4)
GetVolume = CLng(tmp)
End Function

Public Function SetVolume(vol As Long)
Dim a, i As Long
Dim tmp As String
tmp = Right((Hex$(vol + 65536)), 4)
vol = CLng("&H" & tmp & tmp)
a = waveOutSetVolume(0, vol)
End Function

For other devices, look at the examples in ApiGuide.

--
PL


All times are GMT +1. The time now is 07:03 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com