Skip to content

Instantly share code, notes, and snippets.

@catb0t
Created March 6, 2021 16:02
Show Gist options
  • Save catb0t/83cd188ee1fc1dda9ef9a8282c004c4c to your computer and use it in GitHub Desktop.
Save catb0t/83cd188ee1fc1dda9ef9a8282c004c4c to your computer and use it in GitHub Desktop.
#SingleInstance Force
ShowNotification(title, text)
{
notif_option := 0x24 | 32
TrayTip(text, title, notif_option)
}
SetMuteAll(state, check)
{
for d in ["Jack Mic", "Microphone Array"]
{
try
{
if (!check || (check && (SoundGetMute("", d) == !state)))
{
SoundSetMute(state, "", d)
SoundSetMute(state, "1", d)
}
}
}
i := 1
while (i++ < 101)
{
try
{
SoundGetName("", i)
} catch {
break
}
try
{
if (!check || (check && (SoundGetMute("", i) == !state)))
{
; SoundSetMute(state, "", i)
SoundSetMute(state, "Capture", i)
SoundSetMute(state, "Microphone", i)
SoundSetMute(state, "1", i)
}
}
}
}
Init()
{
SetMuteAll(false, false)
}
ToggleMuteAll(state)
{
SetMuteAll(state, true)
}
ico_off := (57*4) + 2
ico_on := (58*4) + 1
OnExit("Cleanup")
Cleanup(a, b)
{
global ico_on
TraySetIcon("imageres.dll", ico_on)
ShowNotification("Toggle Muting Service Exiting", "Unmuting")
SetMuteAll(false, false)
}
TraySetIcon("imageres.dll", ico_on)
Init()
ShowNotification("Toggle Muting Service Started", "Unmuting")
state := true
F12::
{
global state
global ico_on
global ico_off
ToggleMuteAll(state)
TraySetIcon("imageres.dll", (state ? ico_off : ico_on))
ShowNotification((state ? "Muting" : "Unmuting"), ("Microphone " . (state ? "disabled" : "enabled")))
global state := !state
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment