add way to control music volume

This commit is contained in:
David Daily 2020-04-29 20:39:18 -05:00
parent 23ad2dc963
commit c118025c4d
1 changed files with 27 additions and 25 deletions

52
VB.ahk
View File

@ -60,7 +60,7 @@ if (login_result == 1) {
; =============
Volume_Up::
If GetKeyState("Media_Stop")
If GetKeyState("ScrollLock", "T") ; Control music volume if scroll lock is on
{
cLvl := readParam("Strip[2]" . ".Gain")
if (cLvl != "")
@ -96,7 +96,7 @@ Volume_Up::
return
Volume_Down::
If GetKeyState("Media_Stop")
If GetKeyState("ScrollLock", "T") ; Control music volume if scroll lock is on
{
cLvl := readParam("Strip[2]" . ".Gain")
if (cLvl != "")
@ -132,18 +132,16 @@ Volume_Down::
return
Volume_Mute::
If GetKeyState("Media_Stop") ; Mutes all output, and Comms as well for good measure. Basically a kill switch
If (GetKeyState("Media_Stop")) ; Mutes all output, and Comms as well for good measure. Basically a kill switch
{
b0M := Round(readParam("Bus[0]" . ".Mute")) ; Speakers
b1M := Round(readParam("Bus[1]" . ".Mute")) ; Headphones
b3M := Round(readParam("Bus[3]" . ".Mute")) ; Comms
cM := b0M + b1M + b3M
cM := b0M + b1M
if (cM = "3")
if (cM = "2")
{ ; Unmute the ones that were unmuted before
adjustMute("Bus[0]" . ".Mute", b0Ms) ; Speakers
adjustMute("Bus[1]" . ".Mute", b1Ms) ; Headphones
adjustMute("Bus[1]" . ".Mute", b3Ms) ; Comms
} else {
if !(b0M) ; Speakers
{
@ -158,17 +156,9 @@ Volume_Mute::
} else {
b1Ms := False
}
if !(b3M) ; Comms
{
b3Ms := True
} else {
b3Ms := False
}
; Mute
adjustMute("Bus[0]" . ".Mute", "0") ; Speakers
adjustMute("Bus[1]" . ".Mute", "0") ; Headphones
adjustMute("Bus[1]" . ".Mute", "0") ; Comms
}
Return
}
@ -186,6 +176,7 @@ Volume_Mute::
return
!m:: ; Mute: No audio out
Send {F23}
b3M := Round(readParam("Bus[3]" . ".Mute")) ; Comms IN
if !(b3M)
@ -194,22 +185,33 @@ return
} else {
adjustMute("Bus[3]" . ".Mute", "1")
}
Send {F23}
Return
!n:: ; Deafen: No audio in or out
b3M := Round(readParam("Bus[3]" . ".Mute")) ; Comms IN
Send {F24}
s4M := Round(readParam("Strip[4]" . ".Mute")) ; Comms OUT
If (s4M)
{
adjustMute("Bus[3]" . ".Mute", "1")
adjustMute("Strip[4]" . ".Mute", "1")
adjustMute("Bus[3]" . ".Mute", "1") ; Comms IN
adjustMute("Strip[4]" . ".Mute", "1") ; Comms OUT
} else {
adjustMute("Bus[3]" . ".Mute", "0")
adjustMute("Strip[4]" . ".Mute", "0")
adjustMute("Bus[3]" . ".Mute", "0") ; Comms IN
adjustMute("Strip[4]" . ".Mute", "0") ; Comms OUT
}
Return
!j:: ; Mute toggle for skype meeting on work laptop
Send {F24}
cM := Round(readParam("Bus[2]" . ".Mute"))
if (cM)
{
adjustMute("Bus[2]" . ".Mute", "1") ; Work Laptop
}
if !(cM)
{
adjustMute("Bus[2]" . ".Mute", "0") ; Work Laptop
}
Return
@ -240,17 +242,17 @@ readParam(loc){
adjustVolLvl(loc, tVol) {
if (tVol > 12.0)
tVol = 12.0
tVol := 12.0
else if (tVol < -60.0)
tVol = -60.0
tVol := -60.0
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", loc, "Float", tVol, "Int")
}
adjustMute(loc, tM) {
if (tM = 0)
tM = 1
tM := 1
else
tM = 0
tM := 0
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", loc, "Float", tM, "Int")
}