Compare commits
16 Commits
551afbc885
...
master
Author | SHA1 | Date | |
---|---|---|---|
e5198e23d5 | |||
6f37d6aa9e | |||
4375fa11d5 | |||
8e3fc209aa | |||
6f970f33ce | |||
6a6b8ad9c6 | |||
2047191848 | |||
dd4b8fd4df | |||
aba5e85d32 | |||
2a69cd57fe | |||
4eadb236da | |||
0581ed413b | |||
2fcdf6fd3b | |||
c11053c3c3 | |||
04dbc311fe | |||
de33a5956a |
456
VB.ahk
456
VB.ahk
@ -1,4 +1,4 @@
|
|||||||
#NoEnv
|
SetWorkingDir, A_MyDocuments\D3K
|
||||||
#SingleInstance force
|
#SingleInstance force
|
||||||
#MaxHotkeysPerInterval 99000000
|
#MaxHotkeysPerInterval 99000000
|
||||||
#HotkeyInterval 99000000
|
#HotkeyInterval 99000000
|
||||||
@ -7,9 +7,8 @@
|
|||||||
#Persistent
|
#Persistent
|
||||||
ListLines Off
|
ListLines Off
|
||||||
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
|
||||||
SetTitleMatchMode RegEx
|
SetTitleMatchMode, RegEx
|
||||||
StringCaseSense Off
|
StringCaseSense Off
|
||||||
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
|
|
||||||
|
|
||||||
OnExit("cleanup_before_exit")
|
OnExit("cleanup_before_exit")
|
||||||
SetFormat, Float, 0.3
|
SetFormat, Float, 0.3
|
||||||
@ -26,6 +25,7 @@ if (A_Is64bitOS) {
|
|||||||
VMR_DLL_FULL_PATH .= VMR_DLL_FILENAME_32
|
VMR_DLL_FULL_PATH .= VMR_DLL_FILENAME_32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
; == START OF EXECUTION ==
|
; == START OF EXECUTION ==
|
||||||
; ========================
|
; ========================
|
||||||
|
|
||||||
@ -57,6 +57,18 @@ if (login_result == 1) {
|
|||||||
Sleep 2000
|
Sleep 2000
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Switch A_Args[1]
|
||||||
|
{
|
||||||
|
Case "restart":
|
||||||
|
adjustToggle("Command.Restart", "1")
|
||||||
|
Reload ; It doesn't like processing MIDI after we send commands to VM ¯\_(ツ)_/¯
|
||||||
|
Return
|
||||||
|
Case "show":
|
||||||
|
adjustToggle("Command.Show", "1")
|
||||||
|
Reload ; It doesn't like processing MIDI after we send commands to VM ¯\_(ツ)_/¯
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
; == MIDI ==
|
; == MIDI ==
|
||||||
; ==========
|
; ==========
|
||||||
#Include, MIDI\MidiStart.ahk
|
#Include, MIDI\MidiStart.ahk
|
||||||
@ -64,46 +76,102 @@ if (login_result == 1) {
|
|||||||
#Include, MIDI\MidiRules.ahk ; this file contains: Rules for manipulating midi input then sending modified midi output.
|
#Include, MIDI\MidiRules.ahk ; this file contains: Rules for manipulating midi input then sending modified midi output.
|
||||||
#Include, MIDI\Midi_under_the_hood.ahk ; this file contains: (DO NOT EDIT THIS FILE) all the dialogs to set up midi ports and midi message handling.
|
#Include, MIDI\Midi_under_the_hood.ahk ; this file contains: (DO NOT EDIT THIS FILE) all the dialogs to set up midi ports and midi message handling.
|
||||||
|
|
||||||
|
|
||||||
|
; Cases explained so you don't have to go into the korg software:
|
||||||
|
; Faders (Control Channel 1-8, left to right)
|
||||||
|
; 0 = Fader
|
||||||
|
; 1 = Dial
|
||||||
|
; 2 = S
|
||||||
|
; 3 = M
|
||||||
|
; 4 = R
|
||||||
|
; Other buttons (Control Channel 10)
|
||||||
|
; 1 = Track <
|
||||||
|
; 2 = Track >
|
||||||
|
; 3 = Cycle
|
||||||
|
; 4 = Marker Set
|
||||||
|
; 5 = Marker <
|
||||||
|
; 6 = Marker >
|
||||||
|
; 7 = <<
|
||||||
|
; 8 = >>
|
||||||
|
; 9 = Stop
|
||||||
|
; 10 = Play
|
||||||
|
; 11 = Record
|
||||||
|
|
||||||
|
|
||||||
midiCCin:
|
midiCCin:
|
||||||
cc := byte1 ; The Control Channel
|
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))
|
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]."
|
||||||
|
AlissaR := "Strip[7]."
|
||||||
|
|
||||||
|
MicS := "Bus[0]."
|
||||||
|
Speakers := "Bus[1]."
|
||||||
|
;empty := "Bus[2]."
|
||||||
|
PhoneS := "Bus[3]."
|
||||||
|
WorkLapS := "Bus[4]."
|
||||||
|
CommsS := "Bus[5]."
|
||||||
|
AlissaS := "Bus[6]."
|
||||||
|
|
||||||
Switch chan
|
Switch chan
|
||||||
{
|
{
|
||||||
Case 1: ; The first fader: Work Laptop Out
|
Case 1: ; The first fader: Work Laptop
|
||||||
Switch cc
|
Switch cc
|
||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Strip[0].Gain", Lvl)
|
adjustVolLvl(WorkLapR "Gain", Lvl)
|
||||||
|
adjustVolLvl(AlissaR "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 1:
|
Case 1:
|
||||||
Lvl := dial_to_pan(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Strip[0].Pan_x", Lvl)
|
adjustVolLvl(WorkLapS "Gain", Lvl) ; WL Send, hardly ever needs adjusted
|
||||||
|
adjustVolLvl(AlissaS "Gain", Lvl) ; Audio sent to Alissa
|
||||||
|
Return
|
||||||
Case 2:
|
Case 2:
|
||||||
adjustToggle("Strip[0].Solo", val)
|
adjustToggle(WorkLapR "Solo", val)
|
||||||
|
adjustToggle(AlissaR "Solo", val)
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Strip[0].Mute", val)
|
adjustToggle(WorkLapS "Mute", val) ; WL Send mute, if I need to mute it I can just use the fader
|
||||||
|
flag("WLsend", val)
|
||||||
Return
|
Return
|
||||||
Case 4:
|
Case 4:
|
||||||
adjustToggle("Strip[0].B2", val)
|
adjustToggle(WorkLapR "A4", val) ; Sends audio to phone VBAN stream
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
Case 2: ; The second fader: Work Laptop In
|
Case 2: ; The second fader: Phone
|
||||||
Switch cc
|
Switch cc
|
||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Bus[2].Gain", Lvl)
|
adjustVolLvl(PhoneS "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 2, 4:
|
Case 1:
|
||||||
adjustToggle("Bus[2].Mute", val)
|
Lvl := fader_to_fader(val)
|
||||||
|
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
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Bus[2].Mute", val)
|
adjustToggle(PhoneS "Mute", val)
|
||||||
|
adjustToggle(PhoneR "Mute", val)
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
@ -113,70 +181,82 @@ midiCCin:
|
|||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Strip[3].Gain", Lvl)
|
adjustVolLvl(Desktop "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 1:
|
Case 1:
|
||||||
Lvl := dial_to_pan(val)
|
Lvl := dial_to_pan(val)
|
||||||
adjustVolLvl("Strip[3].Pan_x", Lvl)
|
adjustVolLvl(Desktop "Pan_x", Lvl)
|
||||||
Case 2:
|
Case 2:
|
||||||
adjustToggle("Strip[3].Solo", val)
|
adjustToggle(Desktop "Solo", val)
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Strip[3].Mute", val)
|
adjustToggle(Desktop "Mute", val)
|
||||||
Return
|
Return
|
||||||
Case 4:
|
Case 4:
|
||||||
adjustToggle("Strip[3].B2", val)
|
adjustToggle(Desktop "A4", val)
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
Case 4: ; The third fader: Comms In
|
Case 4: ; The fourth fader: Comms Receive
|
||||||
Switch cc
|
Switch cc
|
||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Bus[3].Gain", Lvl)
|
adjustVolLvl(CommsR "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 2: ; PTT
|
Case 1:
|
||||||
if !(val){
|
Lvl := dial_to_pan(val)
|
||||||
cSendMute := Round(readParam("Bus[3].Mute"))
|
adjustVolLvl(CommsR "Pan_x", Lvl)
|
||||||
adjustToggle("Bus[3].Mute", False)
|
; make Telegram go in the opposite direction
|
||||||
} else {
|
Lvl := dial_to_rev_pan(val)
|
||||||
adjustToggle("Bus[3].Mute", cSendMute)
|
adjustVolLvl(AlissaR "Pan_x", Lvl)
|
||||||
}
|
Case 2:
|
||||||
|
adjustToggle(CommsR "Solo", val)
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Bus[3].Mute", val)
|
adjustToggle(CommsR "Mute", val)
|
||||||
Return
|
Return
|
||||||
Case 4: ; Push to mute
|
Case 4: ; sends Comms recieve and Alissa to Phone
|
||||||
if !(val){
|
adjustToggle(CommsR "A4", val)
|
||||||
cSendMute := Round(readParam("Bus[3].Mute"))
|
adjustToggle(AlissaR "A4", val)
|
||||||
adjustToggle("Bus[3].Mute", True)
|
|
||||||
} else {
|
|
||||||
adjustToggle("Bus[3].Mute", cSendMute)
|
|
||||||
}
|
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
Case 5: ; The fifth fader: Comms Out
|
Case 5: ; The fifth fader: Comms Send
|
||||||
Switch cc
|
Switch cc
|
||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Strip[4].Gain", Lvl)
|
adjustVolLvl(CommsS "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 1:
|
Case 2: ; Push to Talk/Mute
|
||||||
Lvl := dial_to_pan(val)
|
if (readParam(CommsS "Mute"))
|
||||||
adjustVolLvl("Strip[4].Pan_x", Lvl)
|
{
|
||||||
Case 2:
|
adjustToggle(CommsS "Mute", False)
|
||||||
adjustToggle("Strip[4].Solo", val)
|
flag("Csend", False)
|
||||||
|
} else {
|
||||||
|
adjustToggle(CommsS "Mute", True)
|
||||||
|
flag("Csend", True)
|
||||||
|
}
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Strip[4].Mute", val)
|
adjustToggle(CommsS "Mute", val)
|
||||||
|
flag("Csend",val)
|
||||||
Return
|
Return
|
||||||
Case 4:
|
Case 4: ; Send music to Discord & Work
|
||||||
adjustToggle("Strip[4].B2", val)
|
adjustToggle(Music "B1", val)
|
||||||
|
adjustToggle(Music "B2", val)
|
||||||
|
adjustToggle(Music "A5", val)
|
||||||
|
if (val)
|
||||||
|
{
|
||||||
|
Send {F22} ; Toggle PTT/Voice Activity (Shows up as UNK133 in discord)
|
||||||
|
Send {F23 down} ; PTT button (Shows up as UNK134 in discord)
|
||||||
|
} else {
|
||||||
|
Send {F23 up}
|
||||||
|
Send {F22} ; Toggle PTT/Voice Activity
|
||||||
|
}
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
@ -186,10 +266,17 @@ midiCCin:
|
|||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Bus[0].Gain", Lvl)
|
adjustVolLvl(Speakers "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
|
Case 1:
|
||||||
|
Lvl := fader_to_fader(val)
|
||||||
|
adjustVolLvl(AlissaR "Gain", Lvl)
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Bus[0].Mute", val)
|
adjustToggle(Speakers "Mute", val)
|
||||||
|
Return
|
||||||
|
Case 4:
|
||||||
|
adjustToggle(AlissaR "Mute", val)
|
||||||
|
adjustToggle(AlissaS "Mute", val)
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
@ -199,13 +286,17 @@ midiCCin:
|
|||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Bus[1].Gain", Lvl)
|
adjustVolLvl(MicS "Gain", Lvl)
|
||||||
|
Return
|
||||||
|
Case 2:
|
||||||
|
adjustToggle(MicR "Mute", val)
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Bus[1].Mute", val)
|
adjustToggle(MicR "Mute", val)
|
||||||
|
adjustToggle(MicS "Mute", val)
|
||||||
Return
|
Return
|
||||||
Case 4: ; Mute mic input
|
Case 4:
|
||||||
adjustToggle("Strip[1].Mute", val)
|
adjustToggle(MicR "Mute", val)
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
@ -215,60 +306,119 @@ midiCCin:
|
|||||||
{
|
{
|
||||||
Case 0:
|
Case 0:
|
||||||
Lvl := fader_to_fader(val)
|
Lvl := fader_to_fader(val)
|
||||||
adjustVolLvl("Strip[2].Gain", Lvl)
|
adjustVolLvl(Music "Gain", Lvl)
|
||||||
Return
|
Return
|
||||||
Case 1:
|
Case 1:
|
||||||
Lvl := dial_to_pan(val)
|
Lvl := dial_to_pan(val)
|
||||||
adjustVolLvl("Strip[2].Pan_x", Lvl)
|
adjustVolLvl(Music "Pan_x", Lvl)
|
||||||
Case 2:
|
Case 2:
|
||||||
adjustToggle("Strip[2].Solo", val)
|
adjustToggle(Music "Solo", val)
|
||||||
Return
|
Return
|
||||||
Case 3:
|
Case 3:
|
||||||
adjustToggle("Strip[2].Mute", val)
|
adjustToggle(Music "Mute", val)
|
||||||
Return
|
Return
|
||||||
Case 4:
|
Case 4:
|
||||||
adjustToggle("Strip[2].B1", val)
|
adjustToggle(Music "A4", val)
|
||||||
adjustToggle("Strip[2].B2", val)
|
|
||||||
Return
|
Return
|
||||||
Default:
|
Default:
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
Case 10: ; VoiceMeeter recorder controls
|
Case 10: ; Buttons on the left
|
||||||
Switch cc
|
Switch cc
|
||||||
{
|
{
|
||||||
Case 1: ; Media Previous
|
Case 1: ; Media Previous
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
Send, {Media_Prev}
|
If (WinActive(nonmusic,, "Music"))
|
||||||
|
{
|
||||||
|
Send, {j} ; Skip back
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
Send, {Media_Prev}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
Case 2: ; Media Next
|
Case 2: ; Media Next
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
Send, {Media_Next}
|
If (WinActive(nonmusic,, "Music"))
|
||||||
|
{
|
||||||
|
Send, {l} ; skip forward
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
Send, {Media_Next}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
Case 3: ; Media Play/Pause
|
Case 3: ; Media Play/Pause
|
||||||
Send, {Media_Play_Pause}
|
If (WinActive(nonmusic,, "Music"))
|
||||||
|
{
|
||||||
|
Send, {Space}
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
Send, {Media_Play_Pause}
|
||||||
|
}
|
||||||
Return
|
Return
|
||||||
Case 4: ; Set button / death sound
|
Case 4: ; Set button
|
||||||
Random, temp, 1, 4
|
if (val)
|
||||||
adjustString("Recorder.Load", "D:\Combine\metropolice\die" . temp . ".wav")
|
{
|
||||||
|
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 {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
Case 5: ; <- under Marker / dislike song
|
||||||
|
if !(val)
|
||||||
|
{
|
||||||
|
Send {F20}
|
||||||
|
}
|
||||||
|
Return
|
||||||
|
Case 6: ; -> under Marker / like song
|
||||||
|
if !(val)
|
||||||
|
{
|
||||||
|
Send {F21}
|
||||||
|
}
|
||||||
Return
|
Return
|
||||||
Case 7: ; Rewind
|
Case 7: ; Rewind
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
adjustToggle("Recorder.REW", true)
|
adjustToggle("Recorder.REW", True)
|
||||||
} else {
|
} else {
|
||||||
adjustToggle("Recorder.Play", true)
|
adjustToggle("Recorder.Play", True)
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
Case 8: ; Fast Forward
|
Case 8: ; Fast Forward
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
adjustToggle("Recorder.FF", true)
|
adjustToggle("Recorder.FF", True)
|
||||||
} else {
|
} else {
|
||||||
adjustToggle("Recorder.Play", true)
|
adjustToggle("Recorder.Play", True)
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
Case 9:
|
Case 9:
|
||||||
@ -290,82 +440,86 @@ midiCCin:
|
|||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
|
|
||||||
fader_to_fader(val) ; Translates MIDI fader values to the VoiceMeeter software faders
|
|
||||||
{
|
|
||||||
; The upper limit for faders in VM is 12.0
|
|
||||||
; The lower limit for the faders in VM that I would like is -40.0, how low it should go when the physical fader is all the way at the bottom
|
|
||||||
nval := Round(((val / 127) * 72) - 60)
|
|
||||||
Return nval
|
|
||||||
}
|
|
||||||
; Formula: ((value / max value) * total range) - negative part of range
|
|
||||||
dial_to_pan(val)
|
|
||||||
{
|
|
||||||
nval := Round((val / 127) - 0.5, 2)
|
|
||||||
Return nval
|
|
||||||
}
|
|
||||||
; == HOTKEYS ==
|
; == HOTKEYS ==
|
||||||
; =============
|
; =============
|
||||||
|
; (untested cause I don't use them)
|
||||||
Volume_Mute::
|
Volume_Mute::
|
||||||
b0M := Round(readParam("Bus[0].Mute")) ; Speakers
|
b0M := readParam(Speakers "Mute") ; Speakers
|
||||||
b1M := Round(readParam("Bus[1].Mute")) ; Headphones
|
b1M := readParam(MicS "Mute") ; Headphones
|
||||||
b2M := Round(readParam("Bus[2].Mute")) ; Work Laptop Send
|
b2M := readParam(WorkLapS "Mute") ; Work Laptop Send
|
||||||
b3M := Round(readParam("Bus[3].Mute")) ; Comms Send
|
b3M := readParam(PhoneS "Mute") ; Comms Send
|
||||||
b4M := Round(readParam("Bus[4].Mute")) ; Recording
|
b4M := readParam(AlissaS "Mute") ; Recording
|
||||||
cM := b0M + b1M + b2M + b3M + b4M
|
cM := b0M + b1M + b2M + b3M + b4M
|
||||||
|
|
||||||
if (cM = "5")
|
if (cM = "5")
|
||||||
{ ; Unmute the ones that were unmuted before
|
{ ; Unmute the ones that were unmuted before
|
||||||
adjustToggle("Bus[0].Mute", b0Ms) ; Speakers
|
adjustToggle(Speakers "Mute", b0Ms) ; Speakers
|
||||||
adjustToggle("Bus[1].Mute", b1Ms) ; Headphones
|
adjustToggle(MicS "Mute", b1Ms) ; Headphones
|
||||||
adjustToggle("Bus[2].Mute", b2Ms) ; Work Laptop Send
|
adjustToggle(WorkLapS "Mute", b2Ms) ; Work Laptop Send
|
||||||
adjustToggle("Bus[3].Mute", b3Ms) ; Comms Send
|
adjustToggle(PhoneS "Mute", b3Ms) ; Comms Send
|
||||||
adjustToggle("Bus[4].Mute", b4Ms) ; Recording
|
adjustToggle(AlissaS "Mute", b4Ms) ; Recording
|
||||||
} else {
|
} else {
|
||||||
adjustToggle("Bus[0].Mute", True) ; Speakers
|
adjustToggle(Speakers "Mute", True) ; Speakers
|
||||||
adjustToggle("Bus[1].Mute", True) ; Headphones
|
adjustToggle(MicS "Mute", True) ; Headphones
|
||||||
adjustToggle("Bus[2].Mute", True) ; Work Laptop Send
|
adjustToggle(WorkLapS "Mute", True) ; Work Laptop Send
|
||||||
adjustToggle("Bus[3].Mute", True) ; Comms Send
|
adjustToggle(PhoneS "Mute", True) ; Comms Send
|
||||||
adjustToggle("Bus[4].Mute", True) ; Recording
|
adjustToggle(AlissaS "Mute", True) ; Recording
|
||||||
b0Ms := b0M
|
b0Ms := b0M
|
||||||
b1Ms := b1M
|
b1Ms := b1M
|
||||||
b2Ms := b2M
|
b2Ms := b2M
|
||||||
b3Ms := b3M
|
b3Ms := b3M
|
||||||
b4Ms := b4M
|
b4Ms := b4M
|
||||||
|
|
||||||
}
|
}
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Volume_Up::
|
|
||||||
cM := Round(readParam("Strip[3].Mute"))
|
|
||||||
|
|
||||||
if !(cM)
|
|
||||||
{
|
|
||||||
cLvl := readParam("Strip[3].Gain")
|
|
||||||
if (cLvl != "")
|
|
||||||
{
|
|
||||||
cLvl += 1
|
|
||||||
adjustVolLvl("Strip[3].Gain", cLvl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Return
|
|
||||||
|
|
||||||
Volume_Down::
|
|
||||||
cM := Round(readParam("Strip[3].Mute"))
|
|
||||||
|
|
||||||
if !(cM)
|
|
||||||
{
|
|
||||||
cLvl := readParam("Strip[3].Gain")
|
|
||||||
if (cLvl != "")
|
|
||||||
{
|
|
||||||
cLvl -= 1
|
|
||||||
adjustVolLvl("Strip[3].Gain", cLvl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Return
|
|
||||||
|
|
||||||
; == Functions ==
|
; == Functions ==
|
||||||
; ===============
|
; ===============
|
||||||
readParam(loc){
|
|
||||||
|
; I need to redo this function...
|
||||||
|
flag(loc, val)
|
||||||
|
{
|
||||||
|
Switch loc
|
||||||
|
{
|
||||||
|
Case "Csend": ; Comms send
|
||||||
|
If !(val) ; Unmuted
|
||||||
|
{
|
||||||
|
If (readParam(WorkLapS "Mute")) ; WLsend unmuted
|
||||||
|
{
|
||||||
|
data := "blink/red"
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
data := "on/green"
|
||||||
|
}
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
data := "off"
|
||||||
|
}
|
||||||
|
Case "WLsend": ; WL send
|
||||||
|
If !(val) ; Unmuted
|
||||||
|
{
|
||||||
|
If !(readParam(CommsS "Mute")) ; Comms muted
|
||||||
|
{
|
||||||
|
data := "blink/red"
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
data := "on/green"
|
||||||
|
}
|
||||||
|
} Else
|
||||||
|
{
|
||||||
|
data := "off"
|
||||||
|
}
|
||||||
|
Default:
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
Run %A_AhkPath% "flag.ahk" %data%
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
readParam(loc)
|
||||||
|
{
|
||||||
Loop
|
Loop
|
||||||
{
|
{
|
||||||
pDirty := DLLCall(VMR_FUNCTIONS["IsParametersDirty"]) ;Check if parameters have changed.
|
pDirty := DLLCall(VMR_FUNCTIONS["IsParametersDirty"]) ;Check if parameters have changed.
|
||||||
@ -381,45 +535,75 @@ readParam(loc){
|
|||||||
tParamVal := 0.0
|
tParamVal := 0.0
|
||||||
NumPut(0.0, tParamVal, 0, "Float")
|
NumPut(0.0, tParamVal, 0, "Float")
|
||||||
statusLvl := DllCall(VMR_FUNCTIONS["GetParameterFloat"], "AStr", loc, "Ptr", &tParamVal, "Int")
|
statusLvl := DllCall(VMR_FUNCTIONS["GetParameterFloat"], "AStr", loc, "Ptr", &tParamVal, "Int")
|
||||||
tParamVal := NumGet(tParamVal, 0, "Float")
|
tParamVal := Round(NumGet(tParamVal, 0, "Float")) ; This wasn't originally rounded, which would return 1.000 instead of 1, which is just silly
|
||||||
if (statusLvl < 0)
|
if (statusLvl < 0)
|
||||||
return ""
|
return ""
|
||||||
else
|
else
|
||||||
return tParamVal
|
return tParamVal
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustVolLvl(loc, tVol) {
|
adjustVolLvl(loc, tVol)
|
||||||
|
{
|
||||||
if (tVol > 12.0)
|
if (tVol > 12.0)
|
||||||
tVol := 12.0
|
tVol := 12.0
|
||||||
else if (tVol < -60.0)
|
else if (tVol < -60.0)
|
||||||
tVol := -60.0
|
tVol := -60.0
|
||||||
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", loc, "Float", tVol, "Int")
|
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", loc, "Float", tVol, "Int")
|
||||||
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustToggle(func, togg) {
|
adjustToggle(func, togg)
|
||||||
|
{
|
||||||
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", func, "Float", togg, "Int")
|
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", func, "Float", togg, "Int")
|
||||||
|
; transition flag logic here?
|
||||||
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
adjustString(func, str) {
|
adjustString(func, str)
|
||||||
MsgBox % str
|
{
|
||||||
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", func, "AStr", str, "Str")
|
DllCall(VMR_FUNCTIONS["SetParameterFloat"], "AStr", func, "AStr", str, "Str")
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
|
fader_to_fader(val) ; Translates MIDI fader values to the VoiceMeeter software faders
|
||||||
|
{
|
||||||
|
; The upper limit for faders in VM is 12.0
|
||||||
|
; The lower limit for the faders in VM that I would like is -40.0, how low it should go when the physical fader is all the way at the bottom
|
||||||
|
nval := Round(((val / 127) * 72) - 60)
|
||||||
|
Return nval
|
||||||
|
}
|
||||||
|
|
||||||
|
; Formula: ((value / max value) * total range) - negative part of range
|
||||||
|
dial_to_pan(val)
|
||||||
|
{
|
||||||
|
nval := Round((val / 127) - 0.5, 2)
|
||||||
|
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)
|
||||||
add_vmr_function(func_name) {
|
{
|
||||||
VMR_FUNCTIONS[func_name] := DllCall("GetProcAddress", "Ptr", VMR_MODULE, "AStr", "VBVMR_" . func_name, "Ptr")
|
VMR_FUNCTIONS[func_name] := DllCall("GetProcAddress", "Ptr", VMR_MODULE, "AStr", "VBVMR_" . func_name, "Ptr")
|
||||||
if (ErrorLevel || VMR_FUNCTIONS[func_name] == 0)
|
if (ErrorLevel || VMR_FUNCTIONS[func_name] == 0)
|
||||||
die("Failed to register VMR function " . func_name . ".")
|
die("Failed to register VMR function " . func_name . ".")
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_before_exit(exit_reason, exit_code) {
|
cleanup_before_exit(exit_reason, exit_code)
|
||||||
|
{
|
||||||
DllCall(VMR_FUNCTIONS["Logout"], "Int")
|
DllCall(VMR_FUNCTIONS["Logout"], "Int")
|
||||||
; OnExit functions must return 0 to allow the app to exit.
|
; OnExit functions must return 0 to allow the app to exit.
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
die(die_string:="UNSPECIFIED FATAL ERROR.", exit_status:=254) {
|
die(die_string:="UNSPECIFIED FATAL ERROR.", exit_status:=254)
|
||||||
|
{
|
||||||
MsgBox 16, FATAL ERROR, %die_string%
|
MsgBox 16, FATAL ERROR, %die_string%
|
||||||
ExitApp exit_status
|
ExitApp exit_status
|
||||||
}
|
}
|
Reference in New Issue
Block a user