My findings on this topic:
I stumbled across an AutoHotKey_L library while trying to overwrite my keyboard's Volume_Up
and Volume_Down
global hotkeys.
The purpose was to be able to control master volume while running restrictive, key press consuming fullscreen applications/games (Bethesda's games as an infamous example).
The functions are pretty straightforward, so I'll just post a little example:
Volume_Up::
newVol := VA_GetMasterVolume() + 5
VA_SetMasterVolume(newVol)
return
Volume_Down::
newVol := VA_GetMasterVolume() - 5
VA_SetMasterVolume(newVol)
return
In principle, this code contains everything you'll need. It overwrites both keys to do the same as before, but instead of relying on the OS to catch the keypress, AutoHotkey sets the volume by itself. Of course, you can specify any other hotkey.
Since there doesn't seem to be a built-in function to change the volume relatively, you'll have to get the current volume first and then in-/ decrease it at will (here: 5
). VA_SetMasterVolume
accepts values between 0.0 and 100.0, inclusive.
To get this working in a restrictive fullscreen windows, it was sufficient to call the #UseHook
directive at the top of my script.
References:
- Library download: Vista Audio Control
Functions
by Lexikos
- VA Online
documentation