hans_larson
asked on
How to get volume settings
Hello experts,
I need to get the master, wave, line, mic and cd volume settings. I don't need to set it, I just need to know what the levels are set to and also if they are muted or not.
I found the following code snippet to get the wav volume level. I don't know how to get the rest of the volume levels and if they are muted.
Please help.
Thanks,
Hans
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub Command1_Click()
Dim a, i As Long
Dim tmp As String
a = waveOutGetVolume(0, i)
tmp = "&h" & Right(Hex$(i), 4)
Text1 = Round(((CLng(tmp)) / 6553.5), 0)
End Sub
I need to get the master, wave, line, mic and cd volume settings. I don't need to set it, I just need to know what the levels are set to and also if they are muted or not.
I found the following code snippet to get the wav volume level. I don't know how to get the rest of the volume levels and if they are muted.
Please help.
Thanks,
Hans
--------------------------
Private Declare Function waveOutGetVolume Lib "Winmm" (ByVal wDeviceID As Integer, dwVolume As Long) As Integer
Private Sub Command1_Click()
Dim a, i As Long
Dim tmp As String
a = waveOutGetVolume(0, i)
tmp = "&h" & Right(Hex$(i), 4)
Text1 = Round(((CLng(tmp)) / 6553.5), 0)
End Sub
ASKER
Brian,
I looked at those links, but they only show how to set the volume and not how to retrieve the current volume and mute status.
Please let me know if you have any other suggestions.
- Hans
I looked at those links, but they only show how to set the volume and not how to retrieve the current volume and mute status.
Please let me know if you have any other suggestions.
- Hans
I ran the project here http://www.mentalis.org/vbexamples/vbexample.php?vbexample=VOLUME&category=SOURCE and read the current values just fine.
Idle_Mind
Idle_Mind
ASKER
Idle_Mind,
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
ASKER
Idle_Mind,
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
I only glanced at the code. I'll take a closer look and see if I can weed out just the information you need.
Idle_Mind
Idle_Mind
ASKER
Idle_Mind,
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
Thanks. I also found that sample and I know it's reading the current values and it works.
What I don't know is how to extract the piece I need. I treid with no luck.
Could you please assist me in pulling the code I need. I need to have the values in a variable, or which function to call and which paramaters I need to pass the function.
Thanks,
Hans
ASKER
Thanks. Sorry for the multiple posts. I had connectivity issues and didn't realize it already sent the data through.
- Hans
- Hans
ASKER
Idle_Mind,
Have you had a chance to look at the code again? I have tried and tried with no avail. I cut code that does not seem to be necessary and then it doesn't work.
Thanks,
Hans
Have you had a chance to look at the code again? I have tried and tried with no avail. I cut code that does not seem to be necessary and then it doesn't work.
Thanks,
Hans
I have looked at the code and your right, there is a lot to cut through to get just the bare minimum for only reading the current volume levels. I have been super busy the past couple of days. I will try to get a solution posted by Monday or Tuesday.
Idle_Mind
Idle_Mind
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. I really appreciate the help.
- Hans
- Hans
Your welcome. I can't really take much credit for it since I didn't write the module code.
There is a lot of code in there but it works. You don't need an instance of a class to use it like the other sample we found.
It's also nice because the way the functions are written using enumerations, the different channel constants pop up in the IDE as you type the function call in. =)
Idle_mind
There is a lot of code in there but it works. You don't need an instance of a class to use it like the other sample we found.
It's also nice because the way the functions are written using enumerations, the different channel constants pop up in the IDE as you type the function call in. =)
Idle_mind
https://www.experts-exchange.com/questions/10601001/Adjust-System-Volume.html
https://www.experts-exchange.com/questions/10689061/Master-Volume-Control.html
Good Luck
-Brian