AutoHotkey Community

It is currently May 26th, 2012, 2:21 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 11  Next
Author Message
 Post subject:
PostPosted: July 12th, 2008, 4:49 pm 
Offline

Joined: November 14th, 2006, 4:40 pm
Posts: 16
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!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2008, 12:12 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Huh?
PostPosted: July 14th, 2008, 4:07 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 9:03 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 5:02 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 10:59 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2008, 5:37 am 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 2nd, 2008, 5:50 pm 
Offline

Joined: May 10th, 2008, 1:00 pm
Posts: 6
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 5th, 2008, 5:27 pm 
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? :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 8th, 2008, 2:40 pm 
Offline

Joined: December 28th, 2006, 9:46 am
Posts: 440
This is beautiful, thank you for your work on this.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: January 19th, 2009, 7:35 pm 
Offline

Joined: December 16th, 2008, 10:07 pm
Posts: 17
Location: Gainesville, FL
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2009, 11:28 pm 
Offline

Joined: December 16th, 2008, 10:07 pm
Posts: 17
Location: Gainesville, FL
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 20th, 2009, 9:51 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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. :oops: 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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 20th, 2009, 5:53 pm 
Offline

Joined: December 16th, 2008, 10:07 pm
Posts: 17
Location: Gainesville, FL
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 20th, 2009, 10:59 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
"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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 151 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6, 7 ... 11  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group