我用了【右Alt】+方向键来调整音量:Alt+上下键,音量调整幅度为5,如果再增加个右Ctrl,音量调整幅度为1。

Alt+左键为静音,Alt+右键为最大音量。

>!Up::    ;音量+
<!Down:: ;音量-
^!Up:: ;音量+
^!Down:: ;音量-
Sound_Add := InStr(A_ThisHotkey, "^") ? :
If InStr(A_ThisHotkey, "Up")
hyf_SoundSetWaveVolume("+", Sound_Add)
Else
hyf_SoundSetWaveVolume("-", Sound_Add)
Return >!Left:: ;静音 {{{
>!Right:: ;音量最大 {{{
hyl_VolumeMinMax:
Sound_Add := InStr(A_ThisHotkey, "Left") ? :
SoundSet, Sound_Add, , , DeviceNumber
hyf_tooltip("音量 " . Sound_Add, , , A_ScreenWidth, A_ScreenHeight)
Return hyf_SoundSetWaveVolume(mode, n)
{ ;mode为"+"或"-"
SoundGet, Sound_Get, , , DeviceNumber
Sound_Get := Round(Sound_Get)
If (n = && (numMod := Mod(Floor(Sound_Get), ))) ;调整到5的倍数
Sound_Get -= numMod
If (mode = "+")
{
Sound_Now := Floor(Sound_Get) + n
If (Sound_Now > )
{
hyf_tooltip("音量+ 100", , , A_ScreenWidth, A_ScreenHeight)
Return
}
}
Else
{
Sound_Now := Floor(Sound_Get) - n
If (Sound_Now < )
{
hyf_tooltip("音量- 0", , , A_ScreenWidth, A_ScreenHeight)
Return
}
}
SoundSet, Sound_Now, , , DeviceNumber
hyf_tooltip("音量" . mode . " " . Sound_Now, , , A_ScreenWidth, A_ScreenHeight)
Return
} hyf_tooltip(str, t := , ExitScript := , x := "", y := "") ;提示t秒并自动消失 {{{
{
t *=
ToolTip, %str%, %x%, %y%
SetTimer, hyf_removeToolTip, -%t%
If ExitScript
{
Gui, Destroy
Exit
}
} hyf_removeToolTip() ;清除ToolTip {{{
{
ToolTip
}
05-17 22:25