aboutsummaryrefslogtreecommitdiff
path: root/tt.volume.ahk
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-23 01:44:02 +0200
committerJohn Ankarström <john@ankarstrom.se>2020-10-23 01:44:02 +0200
commit1f460f7ebc10c2f8bb66ae684498f49187eab9bc (patch)
tree776f7a92b0d24e27cd682e4ff76bde477a02ff98 /tt.volume.ahk
downloadahk-1f460f7ebc10c2f8bb66ae684498f49187eab9bc.tar.gz
first commit
Diffstat (limited to 'tt.volume.ahk')
-rw-r--r--tt.volume.ahk93
1 files changed, 93 insertions, 0 deletions
diff --git a/tt.volume.ahk b/tt.volume.ahk
new file mode 100644
index 0000000..59d16a7
--- /dev/null
+++ b/tt.volume.ahk
@@ -0,0 +1,93 @@
+;; Volume adjustment ----------------------------------------------------------
+
+;; -> body
+
+XButton2::SendInput, {XButton2}
+XButton2 & WheelUp::SetVolume(GetKeyState("Shift") ? 2 : 1)
+XButton2 & WheelDown::SetVolume(GetKeyState("Shift") ? -2 : -1)
+
+RAlt & F6::SetVolume(GetKeyState("Shift") ? 2 : 1)
+RAlt & F5::SetVolume(GetKeyState("Shift") ? -2 : -1)
+
+;; -> library
+
+SetVolume(n)
+{
+ SoundGet, w, WAVE
+ SoundSet, 15
+ w := round(w) + n
+ if (w > 100)
+ w := 100
+ if (w < 0)
+ w := 0
+ SoundSet, %w%, WAVE
+ OSD(w)
+}
+
+/*
+
+SetVolume(n)
+{
+ global wMax
+ static vMin := 4
+
+ SoundGet, s
+ SoundGet, w, WAVE
+ s := round(s)
+ w := round(w)
+
+ if (s > vMin or w > wMax)
+ wMax := w
+ else if (wMax = "")
+ wMax := 100
+
+ v := s + w - wMax + n
+
+ if (v > 100)
+ v := 100
+
+ if (v >= vMin)
+ {
+ s := v
+ w := wMax
+ }
+ else
+ {
+ s := vMin
+ w := wMax - vMin + v
+ }
+
+ SoundSet, %s%
+ SoundSet, %w%, WAVE
+ OSD(v) ; display volume on screen
+}
+
+*/
+
+;; On-screen display ----------------------------------------------------------
+
+;; -> init
+
+Gui, OSD:+AlwaysOnTop +LastFound +Owner +Disabled -Caption
+Gui, OSD:Color, FFFFFF
+Gui, OSD:Font, s30, VCR OSD Mono
+Gui, OSD:Add, Text, vOSD c00BB00, % " "
+WinSet, TransColor, FFFFFF 250
+y := A_ScreenHeight - 100
+Gui, OSD:Show, x0 y%y% AutoSize NA, OSD
+
+;; -> library
+
+OSD(text)
+{
+ SetTimer, RemoveOSD, Off
+ WinSet, AlwaysOnTop, On, OSD
+ GuiControl, OSD:Text, OSD, %text%
+ SetTimer, RemoveOSD, 3000
+ return
+}
+
+RemoveOSD:
+SetTimer, RemoveOSD, Off
+GuiControl, OSD:Text, OSD, % " "
+return