AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Vista Audio Control Functions v2.0
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
FabianBengtsson



Joined: 14 Nov 2006
Posts: 16

PostPosted: Sat Jul 12, 2008 4:49 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4473
Location: Qld, Australia

PostPosted: Sun Jul 13, 2008 12:12 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
thefant
Guest





PostPosted: Mon Jul 14, 2008 4:07 am    Post subject: Huh? Reply with quote

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

PostPosted: Mon Jul 14, 2008 9:03 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
thefant
Guest





PostPosted: Mon Jul 14, 2008 5:02 pm    Post subject: Reply with quote

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

PostPosted: Mon Jul 14, 2008 10:59 pm    Post subject: Reply with quote

This is a function call:
Code:
function(parameter1, parameter2)

The function library is behind that blue thing we call a link. Wink

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
View user's profile Send private message Visit poster's website
thefant
Guest





PostPosted: Tue Jul 15, 2008 5:37 am    Post subject: Reply with quote

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

PostPosted: Tue Sep 02, 2008 5:50 pm    Post subject: Reply with quote

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
View user's profile Send private message
GreenLevel
Guest





PostPosted: Sun Oct 05, 2008 5:27 pm    Post subject: Reply with quote

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? Very Happy
Back to top
adamrgolf



Joined: 28 Dec 2006
Posts: 427

PostPosted: Sat Nov 08, 2008 2:40 pm    Post subject: Reply with quote

This is beautiful, thank you for your work on this.
Back to top
View user's profile Send private message
Washburn



Joined: 16 Dec 2008
Posts: 17
Location: Gainesville, FL

PostPosted: Mon Jan 19, 2009 7:35 pm    Post subject: Use VA library to set volume and mute Reply with quote

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
View user's profile Send private message
Washburn



Joined: 16 Dec 2008
Posts: 17
Location: Gainesville, FL

PostPosted: Mon Jan 19, 2009 11:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4473
Location: Qld, Australia

PostPosted: Tue Jan 20, 2009 9:51 am    Post subject: Reply with quote

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. Embarassed 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
View user's profile Send private message Visit poster's website
Washburn



Joined: 16 Dec 2008
Posts: 17
Location: Gainesville, FL

PostPosted: Tue Jan 20, 2009 5:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 4473
Location: Qld, Australia

PostPosted: Tue Jan 20, 2009 10:59 pm    Post subject: Reply with quote

"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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 4 of 7

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group