lots of updating
This commit is contained in:
parent
8e3fc209aa
commit
4375fa11d5
248
VB.ahk
248
VB.ahk
@ -25,6 +25,7 @@ if (A_Is64bitOS) {
|
||||
VMR_DLL_FULL_PATH .= VMR_DLL_FILENAME_32
|
||||
}
|
||||
|
||||
|
||||
; == START OF EXECUTION ==
|
||||
; ========================
|
||||
|
||||
@ -56,6 +57,17 @@ if (login_result == 1) {
|
||||
Sleep 2000
|
||||
}
|
||||
|
||||
Switch A_Args[1]
|
||||
{
|
||||
Case "restart":
|
||||
adjustToggle("Command.Restart", "1")
|
||||
Reload ; It doesn't like processing MIDI after we restart VM ¯\_(ツ)_/¯
|
||||
Return
|
||||
Case "show":
|
||||
adjustToggle("Command.Show", "1")
|
||||
Return
|
||||
}
|
||||
|
||||
; == MIDI ==
|
||||
; ==========
|
||||
#Include, MIDI\MidiStart.ahk
|
||||
@ -88,6 +100,25 @@ if (login_result == 1) {
|
||||
midiCCin:
|
||||
cc := byte1 ; The Control Channel
|
||||
val := byte2 ; The value (0-127 for faders, 0 or 1 for buttons (that part is set with the software))
|
||||
nonmusic := "Netflix|YouTube|Corridor" ; Windows to control media in instead of music
|
||||
|
||||
; Definitions for the virtual faders
|
||||
WorkLapR := "Strip[0]."
|
||||
MicR := "Strip[1]."
|
||||
PhoneR := "Strip[2]."
|
||||
;empty := "Strip[3]."
|
||||
Music := "Strip[4]."
|
||||
|
||||
Desktop := "Strip[5]."
|
||||
CommsR := "Strip[6]."
|
||||
TelegramR := "Strip[7]."
|
||||
|
||||
MicS := "Bus[0]."
|
||||
Speakers := "Bus[1]."
|
||||
WorkLapS := "Bus[2]."
|
||||
PhoneS := "Bus[3]."
|
||||
TelegramS := "Bus[4]."
|
||||
CommsS := "Bus[5]."
|
||||
|
||||
Switch chan
|
||||
{
|
||||
@ -96,21 +127,21 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Strip[0].Gain", Lvl) ; WL Receive
|
||||
adjustVolLvl(WorkLapR "Gain", Lvl)
|
||||
Return
|
||||
Case 1:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Bus[2].Gain", Lvl) ; WL Send, hardly ever needs adjusted
|
||||
adjustVolLvl(WorkLapS "Gain", Lvl) ; WL Send, hardly ever needs adjusted
|
||||
Return
|
||||
Case 2:
|
||||
adjustToggle("Strip[0].Solo", val)
|
||||
adjustToggle(WorkLapR "Solo", val)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Bus[2].Mute", val) ; WL Send mute, if I need to mute it I can just use the fader
|
||||
adjustToggle(WorkLapS "Mute", val) ; WL Send mute, if I need to mute it I can just use the fader
|
||||
flag("WLsend", val)
|
||||
Return
|
||||
Case 4:
|
||||
adjustToggle("Strip[0].A4", val)
|
||||
adjustToggle(WorkLapR "A4", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -120,14 +151,22 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Bus[3].Gain", Lvl)
|
||||
adjustVolLvl(PhoneS "Gain", Lvl)
|
||||
Return
|
||||
Case 1:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Strip[2].Gain", Lvl)
|
||||
adjustVolLvl(PhoneR "Gain", Lvl)
|
||||
Return
|
||||
Case 2:
|
||||
If (val)
|
||||
{
|
||||
adjustToggle("Command.Restart", val)
|
||||
Reload ; It doesn't like processing MIDI after we restart VM ¯\_(ツ)_/¯
|
||||
}
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Bus[3].Mute", val)
|
||||
adjustToggle("Strip[2].Mute", val)
|
||||
adjustToggle(PhoneS "Mute", val)
|
||||
adjustToggle(PhoneR "Mute", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -137,19 +176,19 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Strip[5].Gain", Lvl)
|
||||
adjustVolLvl(Desktop "Gain", Lvl)
|
||||
Return
|
||||
Case 1:
|
||||
Lvl := dial_to_pan(val)
|
||||
adjustVolLvl("Strip[5].Pan_x", Lvl)
|
||||
adjustVolLvl(Desktop "Pan_x", Lvl)
|
||||
Case 2:
|
||||
adjustToggle("Strip[5].Solo", val)
|
||||
adjustToggle(Desktop "Solo", val)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Strip[5].Mute", val)
|
||||
adjustToggle(Desktop "Mute", val)
|
||||
Return
|
||||
Case 4:
|
||||
adjustToggle("Strip[5].A4", val)
|
||||
adjustToggle(Desktop "A4", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -159,19 +198,23 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Strip[6].Gain", Lvl)
|
||||
adjustVolLvl(CommsR "Gain", Lvl)
|
||||
Return
|
||||
Case 1:
|
||||
Lvl := dial_to_pan(val)
|
||||
adjustVolLvl("Strip[6].Pan_x", Lvl)
|
||||
adjustVolLvl(CommsR "Pan_x", Lvl)
|
||||
; make Telegram go in the opposite direction
|
||||
Lvl := dial_to_rev_pan(val)
|
||||
adjustVolLvl(TelegramR "Pan_x", Lvl)
|
||||
Case 2:
|
||||
adjustToggle("Strip[6].Solo", val)
|
||||
adjustToggle(CommsR "Solo", val)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Strip[6].Mute", val)
|
||||
adjustToggle(CommsR "Mute", val)
|
||||
Return
|
||||
Case 4:
|
||||
adjustToggle("Strip[6].A4", val)
|
||||
Case 4: ; sends Comms recieve and Telegram to Phone
|
||||
adjustToggle(CommsR "A4", val)
|
||||
adjustToggle(TelegramR "A4", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -181,22 +224,26 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Bus[5].Gain", Lvl)
|
||||
adjustVolLvl(CommsS "Gain", Lvl)
|
||||
Return
|
||||
Case 2: ; Push to Talk/Mute
|
||||
if (Round(readParam("Bus[5].Mute"))){
|
||||
adjustToggle("Bus[5].Mute", False)
|
||||
if (readParam(CommsS "Mute"))
|
||||
{
|
||||
adjustToggle(CommsS "Mute", False)
|
||||
} else {
|
||||
adjustToggle("Bus[5].Mute", True)
|
||||
adjustToggle(CommsS "Mute", True)
|
||||
}
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Bus[5].Mute", val)
|
||||
adjustToggle(CommsS "Mute", val)
|
||||
flag("Csend",val)
|
||||
Return
|
||||
Case 4: ; Send music to Discord
|
||||
adjustToggle("Strip[4].B1", val)
|
||||
adjustToggle("Strip[4].B2", val)
|
||||
Case 4: ; Send music to Discord & Work
|
||||
adjustToggle(Music "B1", val)
|
||||
adjustToggle(Music "B2", val)
|
||||
adjustToggle(Music "A3", val)
|
||||
adjustToggle(MicR "Mute", val) ; Mic
|
||||
adjustToggle(PhoneR "Mute", val) ; Phone
|
||||
if (val)
|
||||
{
|
||||
Send {F22} ; Toggle PTT/Voice Activity (Shows up as UNK133 in discord)
|
||||
@ -214,10 +261,10 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Bus[0].Gain", Lvl)
|
||||
adjustVolLvl(Speakers "Gain", Lvl)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Bus[0].Mute", val)
|
||||
adjustToggle(Speakers "Mute", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -227,14 +274,17 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Bus[1].Gain", Lvl)
|
||||
adjustVolLvl(MicS "Gain", Lvl)
|
||||
Return
|
||||
Case 2:
|
||||
adjustToggle(MicR "Mute", val)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Strip[1].Mute", val)
|
||||
adjustToggle("Bus[1].Mute", val)
|
||||
adjustToggle(MicR "Mute", val)
|
||||
adjustToggle(MicS "Mute", val)
|
||||
Return
|
||||
Case 4:
|
||||
adjustToggle("Strip[1].A4", val)
|
||||
adjustToggle(MicR "Mute", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -244,19 +294,19 @@ midiCCin:
|
||||
{
|
||||
Case 0:
|
||||
Lvl := fader_to_fader(val)
|
||||
adjustVolLvl("Strip[4].Gain", Lvl)
|
||||
adjustVolLvl(Music "Gain", Lvl)
|
||||
Return
|
||||
Case 1:
|
||||
Lvl := dial_to_pan(val)
|
||||
adjustVolLvl("Strip[4].Pan_x", Lvl)
|
||||
adjustVolLvl(Music "Pan_x", Lvl)
|
||||
Case 2:
|
||||
adjustToggle("Strip[4].Solo", val)
|
||||
adjustToggle(Music "Solo", val)
|
||||
Return
|
||||
Case 3:
|
||||
adjustToggle("Strip[4].Mute", val)
|
||||
adjustToggle(Music "Mute", val)
|
||||
Return
|
||||
Case 4:
|
||||
adjustToggle("Strip[4].A4", val)
|
||||
adjustToggle(Music "A4", val)
|
||||
Return
|
||||
Default:
|
||||
Return
|
||||
@ -267,17 +317,29 @@ midiCCin:
|
||||
Case 1: ; Media Previous
|
||||
if (val)
|
||||
{
|
||||
Send, {Media_Prev}
|
||||
If (WinActive(nonmusic,, "Music"))
|
||||
{
|
||||
Send, {j} ; Skip back
|
||||
} Else
|
||||
{
|
||||
Send, {Media_Prev}
|
||||
}
|
||||
}
|
||||
Return
|
||||
Case 2: ; Media Next
|
||||
if (val)
|
||||
{
|
||||
Send, {Media_Next}
|
||||
If (WinActive(nonmusic,, "Music"))
|
||||
{
|
||||
Send, {l} ; skip forward
|
||||
} Else
|
||||
{
|
||||
Send, {Media_Next}
|
||||
}
|
||||
}
|
||||
Return
|
||||
Case 3: ; Media Play/Pause
|
||||
If (WinActive("Netflix|YouTube|Corridor",, "Music"))
|
||||
If (WinActive(nonmusic,, "Music"))
|
||||
{
|
||||
Send, {Space}
|
||||
} Else
|
||||
@ -288,12 +350,32 @@ midiCCin:
|
||||
Case 4: ; Set button
|
||||
if (val)
|
||||
{
|
||||
Send {F22} ; Toggle PTT/Voice Activity
|
||||
Send {F23 down}
|
||||
if (readParam(CommsS "Mute"))
|
||||
{
|
||||
adjustToggle(CommsS "Mute", False)
|
||||
remuteC := True
|
||||
}
|
||||
if (readParam(WorkLapS "Mute"))
|
||||
{
|
||||
adjustToggle(WorkLapS "Mute", False)
|
||||
remuteW := True
|
||||
}
|
||||
Send {F22} ; Toggle PTT/Voice Activity
|
||||
Send {F23 down} ; PTT
|
||||
adjustToggle("Recorder.Play", True)
|
||||
} else {
|
||||
Send {F23 up}
|
||||
Send {F22}
|
||||
if (remuteC)
|
||||
{
|
||||
adjustToggle(CommsS "Mute", True)
|
||||
remuteC := ""
|
||||
}
|
||||
if (remuteW)
|
||||
{
|
||||
adjustToggle(WorkLapS "Mute", True)
|
||||
remuteW := ""
|
||||
}
|
||||
Send {F23 up} ; PTT
|
||||
Send {F22} ; Toggle PTT/Voice Activity
|
||||
adjustToggle("Recorder.Stop", True)
|
||||
Sleep, 250
|
||||
adjustToggle("Recorder.Stop", True)
|
||||
@ -349,28 +431,28 @@ Return
|
||||
|
||||
; == HOTKEYS ==
|
||||
; =============
|
||||
; (untested)
|
||||
; (untested cause I don't use them)
|
||||
Volume_Mute::
|
||||
b0M := readParam("Bus[0].Mute") ; Speakers
|
||||
b1M := readParam("Bus[1].Mute") ; Headphones
|
||||
b2M := readParam("Bus[2].Mute") ; Work Laptop Send
|
||||
b3M := readParam("Bus[3].Mute") ; Comms Send
|
||||
b4M := readParam("Bus[4].Mute") ; Recording
|
||||
b0M := readParam(Speakers "Mute") ; Speakers
|
||||
b1M := readParam(MicS "Mute") ; Headphones
|
||||
b2M := readParam(WorkLapS "Mute") ; Work Laptop Send
|
||||
b3M := readParam(PhoneS "Mute") ; Comms Send
|
||||
b4M := readParam(TelegramS "Mute") ; Recording
|
||||
cM := b0M + b1M + b2M + b3M + b4M
|
||||
|
||||
if (cM = "5")
|
||||
{ ; Unmute the ones that were unmuted before
|
||||
adjustToggle("Bus[0].Mute", b0Ms) ; Speakers
|
||||
adjustToggle("Bus[1].Mute", b1Ms) ; Headphones
|
||||
adjustToggle("Bus[2].Mute", b2Ms) ; Work Laptop Send
|
||||
adjustToggle("Bus[3].Mute", b3Ms) ; Comms Send
|
||||
adjustToggle("Bus[4].Mute", b4Ms) ; Recording
|
||||
adjustToggle(Speakers "Mute", b0Ms) ; Speakers
|
||||
adjustToggle(MicS "Mute", b1Ms) ; Headphones
|
||||
adjustToggle(WorkLapS "Mute", b2Ms) ; Work Laptop Send
|
||||
adjustToggle(PhoneS "Mute", b3Ms) ; Comms Send
|
||||
adjustToggle(TelegramS "Mute", b4Ms) ; Recording
|
||||
} else {
|
||||
adjustToggle("Bus[0].Mute", True) ; Speakers
|
||||
adjustToggle("Bus[1].Mute", True) ; Headphones
|
||||
adjustToggle("Bus[2].Mute", True) ; Work Laptop Send
|
||||
adjustToggle("Bus[3].Mute", True) ; Comms Send
|
||||
adjustToggle("Bus[4].Mute", True) ; Recording
|
||||
adjustToggle(Speakers "Mute", True) ; Speakers
|
||||
adjustToggle(MicS "Mute", True) ; Headphones
|
||||
adjustToggle(WorkLapS "Mute", True) ; Work Laptop Send
|
||||
adjustToggle(PhoneS "Mute", True) ; Comms Send
|
||||
adjustToggle(TelegramS "Mute", True) ; Recording
|
||||
b0Ms := b0M
|
||||
b1Ms := b1M
|
||||
b2Ms := b2M
|
||||
@ -380,37 +462,11 @@ Volume_Mute::
|
||||
}
|
||||
Return
|
||||
|
||||
Volume_Up::
|
||||
cM := readParam("Strip[3].Mute")
|
||||
|
||||
if !(cM)
|
||||
{
|
||||
cLvl := readParam("Strip[3].Gain")
|
||||
if (cLvl != "")
|
||||
{
|
||||
cLvl += 1
|
||||
adjustVolLvl("Strip[3].Gain", cLvl)
|
||||
}
|
||||
}
|
||||
Return
|
||||
|
||||
Volume_Down::
|
||||
cM := readParam("Strip[3].Mute")
|
||||
|
||||
if !(cM)
|
||||
{
|
||||
cLvl := readParam("Strip[3].Gain")
|
||||
if (cLvl != "")
|
||||
{
|
||||
cLvl -= 1
|
||||
adjustVolLvl("Strip[3].Gain", cLvl)
|
||||
}
|
||||
}
|
||||
Return
|
||||
|
||||
; == Functions ==
|
||||
; ===============
|
||||
|
||||
; I need to redo this function...
|
||||
flag(loc, val)
|
||||
{
|
||||
Switch loc
|
||||
@ -418,7 +474,7 @@ flag(loc, val)
|
||||
Case "Csend": ; Comms send
|
||||
If !(val) ; Unmuted
|
||||
{
|
||||
If !(readParam("Bus[2].Mute")) ; WLsend unmuted
|
||||
If (readParam(WorkLapS "Mute")) ; WLsend unmuted
|
||||
{
|
||||
data := "blink/red"
|
||||
} Else
|
||||
@ -432,7 +488,7 @@ flag(loc, val)
|
||||
Case "WLsend": ; WL send
|
||||
If !(val) ; Unmuted
|
||||
{
|
||||
If (readParam("Bus[5].Mute")) ; Comms muted
|
||||
If !(readParam(CommsS "Mute")) ; Comms muted
|
||||
{
|
||||
data := "blink/red"
|
||||
} Else
|
||||
@ -446,7 +502,7 @@ flag(loc, val)
|
||||
Default:
|
||||
Return
|
||||
}
|
||||
run %A_AhkPath% "flag.ahk" %data%
|
||||
Run %A_AhkPath% "flag.ahk" %data%
|
||||
Return
|
||||
}
|
||||
|
||||
@ -487,6 +543,7 @@ adjustVolLvl(loc, tVol)
|
||||
adjustToggle(func, togg)
|
||||
{
|
||||
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", func, "Float", togg, "Int")
|
||||
; transition flag logic here?
|
||||
Return
|
||||
}
|
||||
|
||||
@ -511,6 +568,13 @@ dial_to_pan(val)
|
||||
Return nval
|
||||
}
|
||||
|
||||
dial_to_rev_pan(val) ; Pans in the opposite direction
|
||||
{
|
||||
val := Round((val / 127) - 0.5, 2)
|
||||
val := -val
|
||||
Return val
|
||||
}
|
||||
|
||||
|
||||
add_vmr_function(func_name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user