 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
FabianBengtsson
Joined: 14 Nov 2006 Posts: 16
|
Posted: Sat Jul 12, 2008 4:49 pm Post subject: |
|
|
I possible, in some way, to set the volume/mute a specified application with this script ?
For example if you want to set volume of foobar music player, could you do something like this?
| Code: | | VA_SetMasterVolume("10"," ","foobar2000 Application") |
_________________ Don't capture me again!! |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Sun Jul 13, 2008 12:12 am Post subject: |
|
|
| Quote: | | I'm so stupid.. I Quoted the Integer i.e. "5" as the parameter, and should have just passed the integer |
There must have been something else, because either way the value is stored as a string (the character "5") in the subunit_desc parameter of VA_GetMute. Your previous code works for me.
| FabianBengtsson wrote: | | I possible, in some way, to set the volume/mute a specified application with this script ? | No. I looked into it a while ago, and unfortunately it does not seem possible. |
|
| Back to top |
|
 |
thefant Guest
|
Posted: Mon Jul 14, 2008 4:07 am Post subject: Huh? |
|
|
| I feel somewhat unintelligent asking this, but...how exactly do I get this to work? I downloaded the Vista Audio Control Functions v2.0 in the .zip file...now what? |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Mon Jul 14, 2008 9:03 am Post subject: |
|
|
Get COM.ahk if you haven't already. VA.ahk and COM.ahk should be placed in your function library.
In the auto-execute section of the script you will be using VA from, call COM_Init(). This initializes COM, which is used by VA. Find the function you want to call in the VA documentation, then simply call it.
I cannot be more specific without knowing what it is you want to do with VA. |
|
| Back to top |
|
 |
thefant Guest
|
Posted: Mon Jul 14, 2008 5:02 pm Post subject: |
|
|
Where is the function library? And how do I "call"?
I just want to mute my MIDI. I went looking for solutions on how to do this about a week ago, and I eventually found this. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Mon Jul 14, 2008 10:59 pm Post subject: |
|
|
This is a function call:
| Code: | | function(parameter1, parameter2) |
The function library is behind that blue thing we call a link.
The script in the first post of this thread lists the available subunits. Unless there is a subunit "MIDI Mute" or similar, you'll need to use trial and error to determine which one it is. If they all have the same name, use numbering.
| Code: | ; In the auto-execute section (the top of the script):
COM_Init()
;...
VA_SetMute(true, "MIDI Mute")
; or
VA_SetMute(true, 1) ; 2, 3, etc.
| It may help to have the properties of your playback device open as you run the script, to see if anything happens. (Usually Control Panel -> Sound -> Playback -> Speakers -> Properties -> Levels.) |
|
| Back to top |
|
 |
thefant Guest
|
Posted: Tue Jul 15, 2008 5:37 am Post subject: |
|
|
| And with that, I think I have it figured out. I don't have much experience with stuff like this, so thanks for your help! |
|
| Back to top |
|
 |
LPent
Joined: 10 May 2008 Posts: 6
|
Posted: Tue Sep 02, 2008 5:50 pm Post subject: |
|
|
| I can only mute playback devices, not recording devices. Why is that? I really want to be able to mute my microphone input by means of a hotkey. |
|
| Back to top |
|
 |
GreenLevel Guest
|
Posted: Sun Oct 05, 2008 5:27 pm Post subject: |
|
|
Hello! I know this is a Vista audio thread,.... but wondering if is it possible in some way, that will hopefully work in XP & Vista, output in a Tooltip the active peak value of the default audio device?  |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 427
|
Posted: Sat Nov 08, 2008 2:40 pm Post subject: |
|
|
| This is beautiful, thank you for your work on this. |
|
| Back to top |
|
 |
Washburn
Joined: 16 Dec 2008 Posts: 17 Location: Gainesville, FL
|
Posted: Mon Jan 19, 2009 7:35 pm Post subject: Use VA library to set volume and mute |
|
|
I used the VA library to set volume and mute for the Stereo Mix and Microphone on a box with the Vista OS. I was able to get the Stereo Mix to work, but not able to get the Microphone to work. I tried several ways to call out the microphone subunit, based on the comments listed in the Vista Audio Control Function line of discussion, such as:
1
Mic Volume
Mic Mute
Microphone
Here is my code:
| Code: |
#NoEnv
COM_CoInitialize()
VA_SetVolume(100.0,1,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,2,"Stereo Mix:1")
VA_SetMute(0,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,1,"Microphone:1")
VA_SetVolume(100.0,1,2,"Microphone:1")
VA_SetMute(0,1,"Microphone:1")
COM_CoUninitialize()
|
If you have any ideas as to why the microphone settings for volume and mute will not work, please let me know. Thanks in advance. _________________ My Username comes from the name of a mountain peak in Yellowstone N.P.
Question: Does a bear do its duty in the woods.
Answer: It most certainly does, as well as anywhere else it chooses. |
|
| Back to top |
|
 |
Washburn
Joined: 16 Dec 2008 Posts: 17 Location: Gainesville, FL
|
Posted: Mon Jan 19, 2009 11:28 pm Post subject: |
|
|
I was able to set the microphone volume and mute by using the following code:
| Code: |
#NoEnv
COM_CoInitialize()
VA_SetVolume(100.0,1,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,2,"Stereo Mix:1")
VA_SetMute(0,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,1,"capture:4") ;microphone channel 1 volume
VA_SetVolume(100.0,1,2,"capture:4") ;microphone channel 2 volume
VA_SetMute(0,1,"capture:4") ;microphone mute
COM_CoUninitialize()
|
This is all good because it gets me a step closer, but I have a problem with this. It's possible because of the ordering of other devices, that the microphone will not always be at the index 4. Is there a way that I can check to see that I have the microphone in index 4? _________________ My Username comes from the name of a mountain peak in Yellowstone N.P.
Question: Does a bear do its duty in the woods.
Answer: It most certainly does, as well as anywhere else it chooses. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Tue Jan 20, 2009 9:51 am Post subject: |
|
|
It should work if you specify whole or part of the correct name. I was going to suggest using the topology script in my first post, but then I realised I still haven't updated it to support multiple devices. You may use the following script to list device names:
| Code: | COM_Init()
prefix_list = playback:,capture:
Loop, Parse, prefix_list, `,
{
Loop {
if !(device := VA_GetDevice(A_LoopField A_Index))
break
device_list .= A_LoopField A_Index "=" VA_GetDeviceName(device) "`n"
COM_Release(device)
}
}
COM_Term()
MsgBox % device_list |
|
|
| Back to top |
|
 |
Washburn
Joined: 16 Dec 2008 Posts: 17 Location: Gainesville, FL
|
Posted: Tue Jan 20, 2009 5:53 pm Post subject: |
|
|
Hi Lexikos,
Here is what I figured out with my next step. Once I knew that "capture:4" worked for the device description, I used that to create a script test to get the device name, which is "Microphone (Realtek High Definition Audio)". With the device name, I was able to write the script so it could find the microphone and then use the correct capture index to access the device in order to set the volume and mute values. Here is the code:
| Code: |
#NoEnv
COM_CoInitialize()
VA_SetVolume(100.0,1,1,"Stereo Mix:1")
VA_SetVolume(100.0,1,2,"Stereo Mix:1")
VA_SetMute(0,1,"Stereo Mix:1")
;Loop to find the microphone capture device
i := 1
notFound := true
Loop
{
if (notFound = false)
break ;Terminate the loop
;Get the device name
device_desc := "capture:" . i
device := VA_GetDevice(device_desc)
device_name := VA_GetDeviceName(device)
;Compare the device name for loop termination
if (device_name == "Microphone (Realtek High Definition Audio)")
notFound := false
else
i := i+1
}
VA_SetVolume(100.0,1,1,device_desc)
VA_SetVolume(100.0,1,2,device_desc)
VA_SetMute(0,1,device_desc)
COM_CoUninitialize()
|
It has been a challenge to figure out a way to set the volume and mute for the microphone and stereo mix devices/subunits. I hope this helps the other folks out there that are trying to solve this problem. I need to integrate this with the rest of my script and make sure it all works together. I will report back and thanks for your assistance as well as the assistance of others. _________________ My Username comes from the name of a mountain peak in Yellowstone N.P.
Question: Does a bear do its duty in the woods.
Answer: It most certainly does, as well as anywhere else it chooses. |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 4473 Location: Qld, Australia
|
Posted: Tue Jan 20, 2009 10:59 pm Post subject: |
|
|
"Microphone:1" should be sufficient... Would you like to try the following?
| Code: | COM_Init()
device := VA_GetDevice("Microphone:1")
if device
MsgBox % VA_GetDeviceName(device)
else
MsgBox no device |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|