From 96de917b64050a1502397ac41806bc4c87dd0e8d Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 15 Sep 2023 11:35:27 +0100 Subject: [PATCH] gain slider control events registered allows adjusting gain by different amounts. --- src/nvda_voicemeeter/window.py | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 42967ef..35d9a1d 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -206,6 +206,12 @@ class NVDAVMWindow(psg.Window): for i in range(self.kind.num_strip): self[f"STRIP {i}||SLIDER GAIN"].bind("", "||FOCUS IN") self[f"STRIP {i}||SLIDER GAIN"].bind("", "||FOCUS OUT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY LEFT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY RIGHT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY SHIFT LEFT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY SHIFT RIGHT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY CTRL LEFT") + self[f"STRIP {i}||SLIDER GAIN"].bind("", "||KEY CTRL RIGHT") # Bus Params params = ["MONO", "EQ", "MUTE", "MODE"] @@ -220,6 +226,12 @@ class NVDAVMWindow(psg.Window): for i in range(self.kind.num_bus): self[f"BUS {i}||SLIDER GAIN"].bind("", "||FOCUS IN") self[f"BUS {i}||SLIDER GAIN"].bind("", "||FOCUS OUT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY LEFT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY RIGHT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY SHIFT LEFT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY SHIFT RIGHT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY CTRL LEFT") + self[f"BUS {i}||SLIDER GAIN"].bind("", "||KEY CTRL RIGHT") def popup_save_as(self, message, title=None, initial_folder=None): layout = [ @@ -666,6 +678,22 @@ class NVDAVMWindow(psg.Window): self.nvda.speak(f"{label} gain slider {val}") case [["STRIP", index], ["SLIDER", "GAIN"], ["FOCUS", "OUT"]]: self.vm.event.pdirty = True + case [["STRIP", index], ["SLIDER", "GAIN"], ["KEY", "LEFT" | "RIGHT" as direction]]: + val = values[f"STRIP {index}||SLIDER GAIN"] + if direction == "LEFT": + val -= 0.9 + else: + val += 0.9 + self[f"STRIP {index}||SLIDER GAIN"].update(value=val) + case [["STRIP", index], ["SLIDER", "GAIN"], ["KEY", "CTRL", "LEFT" | "RIGHT" as direction]]: + val = values[f"STRIP {index}||SLIDER GAIN"] + if direction == "LEFT": + val += 4.2 + else: + val -= 4.2 + self[f"STRIP {index}||SLIDER GAIN"].update(value=val) + case [["STRIP", index], ["SLIDER", "GAIN"], ["KEY", "SHIFT", "LEFT" | "RIGHT" as direction]]: + self[f"STRIP {index}||SLIDER GAIN"].update(value=values[f"STRIP {index}||SLIDER GAIN"]) # Bus Params case [["BUS", index], [param]]: @@ -740,6 +768,22 @@ class NVDAVMWindow(psg.Window): self.nvda.speak(f"{label} gain slider {val}") case [["BUS", index], ["SLIDER", "GAIN"], ["FOCUS", "OUT"]]: self.vm.event.pdirty = True + case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "LEFT" | "RIGHT" as direction]]: + val = values[f"BUS {index}||SLIDER GAIN"] + if direction == "LEFT": + val -= 0.9 + else: + val += 0.9 + self[f"BUS {index}||SLIDER GAIN"].update(value=val) + case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "CTRL", "LEFT" | "RIGHT" as direction]]: + val = values[f"BUS {index}||SLIDER GAIN"] + if direction == "LEFT": + val += 4.2 + else: + val -= 4.2 + self[f"BUS {index}||SLIDER GAIN"].update(value=val) + case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "SHIFT", "LEFT" | "RIGHT" as direction]]: + self[f"BUS {index}||SLIDER GAIN"].update(value=values[f"BUS {index}||SLIDER GAIN"]) # Unknown case _: