Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Vista Audio Control Functions


  • Please log in to reply
182 replies to this topic
Loila
  • Guests
  • Last active:
  • Joined: --
Sorry but i don't understand anything :/ I'm a bit familiar with autohotkey, but concretly, how to mute 'line in' with a hotkey?

Is there only the script to run? Must we copy the com.ahk script before yours?

How do we access to all the functions?

Sorry if i'm a nub but i'd really like to use it :)

Thanks

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
COM.ahk and VA.ahk should be placed in a function library folder. This allows AutoHotkey to automatically load VA.ahk (and COM.ahk) when the script starts if it calls any VA_() functions. Then, assuming the subunit name contains the word "Line", you may use this to toggle mute:
COM_Init()
VA_SetMute(!VA_GetMute("Line"),"Line")
COM_Term()
..or if you call COM_Init() at the start of your script, you may omit COM_Init() and COM_Term() from the above. For instance,
COM_Init()

^Volume_Mute::
    VA_SetMute(!VA_GetMute("Line"),"Line")
return


Loila
  • Guests
  • Last active:
  • Joined: --
Thanks for your quick answer :)

I've moved VA and COM in a new directory 'Lib' at the same level than autohotkey.exe

in my main script i wrote:

#!o::
COM_Init()
VA_SetMute(!VA_GetMute("Line"),"Line")
COM_Term()
return

but nothing happen :S

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Not even an error message? I guess the subunit name "Line" is incorrect. (It only needs to be a partial name.) Try running the Device Topology script in my first post, and post the list of "MUTE SUBUNITS" it outputs. I get the following:
Master Mute
Mic Mute
[color=red]Line Mute[/color]
CD Mute
Video Mute
Aux Mute
SPDIF
MIDI Mute


  • Guests
  • Last active:
  • Joined: --
Weird :/ That's what i get:

VOLUME SUBUNITS

Speakers
PC Beep
Microphone
Aux
CD Audio
Line In


MUTE SUBUNITS

Master Mute
Mute
Mute
Mute
Mute
Mute


Loila
  • Guests
  • Last active:
  • Joined: --
and no error message at all

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
You'll need to use a number (between 1 and the number of mute subunits) instead of "Line". Figure out which one by trial and error.

Loila
  • Guests
  • Last active:
  • Joined: --
It was the 6 ! Thanks thanks thanks :)

hjbotha
  • Members
  • 4 posts
  • Last active: Dec 09 2013 05:36 PM
  • Joined: 04 Apr 2008
Thanks very much for this lib, Lexikos. It's helped me adapt Rajat's OSD script for Vista, as you can see here: <!-- m -->http://www.autohotke...pic.php?t=30432<!-- m -->

I've noticed that, at least on my machine, VA_SetMasterVolume doesn't seem to be able to reduce the volume to 0.

Running a script with
COM_Init()
VA_SetMasterVolume(0)
has no effect

But running
COM_Init()
VA_SetMasterVolume(0.01)
does.

H

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006
Perhaps it is a driver quirk. It works on my end.

The volume level is normalized to the range from 0 to 1, where 0 is the minimum volume level and 1 is the maximum level.

(VA_SetMasterVolume divides by 100.)

Tekl
  • Members
  • 814 posts
  • Last active: May 03 2009 03:28 PM
  • Joined: 24 Sep 2004
Hi,

I've the problem that for some subunits the db2scalar and scalar2db functions won't work well. One subunit will move the slider in the mixer with bigger steps at the beginning and another subunit has bigger steps at the end.
Tekl

..:: Free Radical ::..
  • Members
  • 74 posts
  • Last active: May 30 2015 12:13 PM
  • Joined: 20 Sep 2006
Awesome function man. Thank you for this.

  • Guests
  • Last active:
  • Joined: --
I can not seem to control any of the components volume nor Mute functionality. I've even tried using just a Number. (I tried 1 - 10)
any thoughts?

#!o::
COM_Init()
VA_SetMute(!VA_GetMute("5"),"5")
return


Here's my output from your GUI:
VOLUME SUBUNITS

Volume
Volume
Volume
Volume
Volume
Volume
Volume


MUTE SUBUNITS

Mute
Mute
Mute
Mute
Mute
Mute
Mute


With the Main window showing:
+ (CONNECTOR) Play Control : {4509F757-2D46-4637-8E62-CE7DB944F57B}
   + Mute : IAudioMute
      + Bass Balance : {A2B1A1D9-4DB3-425D-A2B2-BD335CB3E2E5}
         + Treble Balance : {0A717812-694E-4907-B74B-BAFA5CFDCA7B}
            + Volume : IAudioVolumeLevel
               + Sum
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) Microphone FP : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN) 
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) Digital-In : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN) 
                  + (CONNECTOR) Wave : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                     + (UNKNOWN) 
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) MIDI Synth : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN) 
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) Line-In : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN) 
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) Auxiliary : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN) 
                  + Mute : IAudioMute
                     + Volume : IAudioVolumeLevel
                        + (CONNECTOR) Microphone : {4509F757-2D46-4637-8E62-CE7DB944F57B}
                           + (UNKNOWN)


Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

#!o::
COM_Init()
VA_SetMute(!VA_GetMute("5"),"5")
return

It probably isn't really a problem in this case, but generally you should either call COM_Init once at the start of the script, or COM_Term once for each COM_Init.
COM_Init() ; Initialize COM once.
#!o::VA_SetMute(!VA_GetMute("5"),"5")
#!o::
    COM_Init() ; Load COM.
    VA_SetMute(!VA_GetMute("5"),"5")
    COM_Term() ; Unload COM.
return
What does the following give you? Does it reflect the mute status shown in the properties of your playback device?
COM_Init()
Loop 7
    t .= VA_GetMute(A_Index) ", "
Clipboard := t
MsgBox %t%


  • Guests
  • Last active:
  • Joined: --
I solved it!

I'm so stupid.. I Quoted the Integer i.e. "5" as the parameter, and should have just passed the integer

this hit me as I slept... :)

VA_SetMute(!VA_GetMute("5"),"5")

SHOULD have been

VA_SetMute(!VA_GetMute(5),5)


What was I thinking...