Last active
February 12, 2021 23:51
-
-
Save jep-a/a4e667edc4b2f62c57a265c720b3541a to your computer and use it in GitHub Desktop.
Autohotkey Mic Mute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include %A_MyDocuments%\AutoHotkey\Lib\KeyboardLED.ahk | |
KEY_HOLD_DELAY := 250 | |
MIC_ID := 13 | |
MIC_CHECK_INTERVAL := 500 | |
MIC_RELEASE_DELAY := 250 | |
MicLEDFromSound() | |
{ | |
global MIC_ID | |
SoundGet, muted, , MUTE, MIC_ID | |
KeyboardLED(4, muted != "On" ? "on" : "off", 0) | |
} | |
SetTimer, CheckMicLED, %MIC_CHECK_INTERVAL% | |
MicLEDFromSound() | |
F20:: | |
F21:: | |
{ | |
global MIC_ID | |
SoundSet, +1, MASTER, MUTE, MIC_ID | |
MicLEDFromSound() | |
KeyWait, %A_ThisHotkey% | |
{ | |
if (A_TimeSinceThisHotkey > KEY_HOLD_DELAY) { | |
Sleep, MIC_RELEASE_DELAY | |
SoundSet, +1, MASTER, MUTE, MIC_ID | |
MicLEDFromSound() | |
} else { | |
MicLEDFromSound() | |
} | |
} | |
return | |
} | |
CheckMicLED: | |
{ | |
MicLEDFromSound() | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment