From 3d7b33c8bec4b2abd4918b48b5bf4b654147cf82 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Sun, 17 Sep 2023 10:18:22 +0100 Subject: [PATCH] fix events for sliders --- src/nvda_voicemeeter/window.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 7553bff..61183f8 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -194,14 +194,11 @@ class NVDAVMWindow(psg.Window): # Strip Sliders for i in range(self.kind.num_strip): - for param in ("GAIN", "LIMIT"): + for param in util.get_slider_params(i, self.vm) + ("GAIN", "LIMIT"): if self.kind.name == "basic" and param == "LIMIT": continue self[f"STRIP {i}||SLIDER {param}"].bind("", "||FOCUS IN") self[f"STRIP {i}||SLIDER {param}"].bind("", "||FOCUS OUT") - for param in util.get_slider_params(i, self.vm): - self[f"STRIP {i}||SLIDER {param}"].bind("", "||FOCUS IN") - self[f"STRIP {i}||SLIDER {param}"].bind("", "||FOCUS OUT") self[f"STRIP {i}||SLIDER {param}"].bind("", "||KEY LEFT") self[f"STRIP {i}||SLIDER {param}"].bind("", "||KEY RIGHT") self[f"STRIP {i}||SLIDER {param}"].bind("", "||KEY SHIFT LEFT") @@ -677,8 +674,6 @@ class NVDAVMWindow(psg.Window): # Strip Sliders case [["STRIP", index], ["SLIDER", "GAIN"]]: label = self.cache["labels"][f"STRIP {index}||LABEL"] - val = values[event] - self.vm.strip[int(index)].gain = val self.nvda.speak(f"{label} gain slider {val}") case [["STRIP", index], ["SLIDER", "GAIN"], ["FOCUS", "IN"]]: if self.find_element_with_focus() is not None: @@ -696,7 +691,7 @@ class NVDAVMWindow(psg.Window): case "LEFT" | "DOWN": val -= 1 self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12)) - self[f"STRIP {index}||SLIDER GAIN"].update(value=val) + self[f"STRIP {index}||SLIDER GAIN"].update(value=util.check_bounds(val, (-60, 12))) case [ ["STRIP", index], ["SLIDER", "GAIN"], @@ -709,7 +704,7 @@ class NVDAVMWindow(psg.Window): case "LEFT" | "DOWN": val -= 3 self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12)) - self[f"STRIP {index}||SLIDER GAIN"].update(value=val) + self[f"STRIP {index}||SLIDER GAIN"].update(value=util.check_bounds(val, (-60, 12))) case [ ["STRIP", index], ["SLIDER", "GAIN"], @@ -722,7 +717,7 @@ class NVDAVMWindow(psg.Window): case "LEFT" | "DOWN": val -= 0.1 self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12)) - self[f"STRIP {index}||SLIDER GAIN"].update(value=val) + self[f"STRIP {index}||SLIDER GAIN"].update(value=util.check_bounds(val, (-60, 12))) # Bus Params case [["BUS", index], [param]]: