+10, +50 step binds added for gate

bump to version 0.5.0a2
Initial gate slider implementation
for Issue #14
This commit is contained in:
onyx-and-iris 2023-09-26 17:20:15 +01:00
parent 6882adb47b
commit abab560281
3 changed files with 81 additions and 6 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "nvda_voicemeeter" name = "nvda_voicemeeter"
version = "0.5.0a1" version = "0.5.0a2"
description = "A Voicemeeter app compatible with NVDA" description = "A Voicemeeter app compatible with NVDA"
authors = [ authors = [
{ name = "onyx-and-iris", email = "code@onyxandiris.online" }, { name = "onyx-and-iris", email = "code@onyxandiris.online" },

View File

@ -191,9 +191,14 @@ class LabelSliderAdvanced(psg.Frame):
"""Compound Label Slider element for Advanced Comp|Gate""" """Compound Label Slider element for Advanced Comp|Gate"""
def __init__(self, parent, index, param, slider_cls: Union[CompSlider, GateSlider], *args, **kwargs): def __init__(self, parent, index, param, slider_cls: Union[CompSlider, GateSlider], *args, **kwargs):
label_map = {
"DAMPING": "Damping Max",
"BPSIDECHAIN": "BP Sidechain",
}
layout = [ layout = [
[ [
psg.Text(param.capitalize(), size=8), psg.Text(label_map.get(param, param.title()), size=10),
slider_cls(parent.vm, index, param), slider_cls(parent.vm, index, param),
] ]
] ]

View File

@ -489,6 +489,13 @@ class Popup:
popup[f"GATE||SLIDER {param}"].bind( popup[f"GATE||SLIDER {param}"].bind(
f"<Control-{event}-{direction}>", f"||KEY CTRL {direction.upper()} {event_id}" f"<Control-{event}-{direction}>", f"||KEY CTRL {direction.upper()} {event_id}"
) )
if param in ("BPSIDECHAIN", "ATTACK", "HOLD", "RELEASE"):
popup[f"GATE||SLIDER {param}"].bind(
f"<Alt-{event}-{direction}>", f"||KEY ALT {direction.upper()} {event_id}"
)
popup[f"GATE||SLIDER {param}"].bind(
f"<Control-Alt-{event}-{direction}>", f"||KEY CTRL ALT {direction.upper()} {event_id}"
)
popup["Exit"].bind("<FocusIn>", "||FOCUS IN") popup["Exit"].bind("<FocusIn>", "||FOCUS IN")
popup["Exit"].bind("<Return>", "||KEY ENTER") popup["Exit"].bind("<Return>", "||KEY ENTER")
while True: while True:
@ -501,7 +508,11 @@ class Popup:
case [["GATE"], ["SLIDER", param]]: case [["GATE"], ["SLIDER", param]]:
setattr(self.window.vm.strip[index].gate, param.lower(), values[event]) setattr(self.window.vm.strip[index].gate, param.lower(), values[event])
case [["GATE"], ["SLIDER", param], ["FOCUS", "IN"]]: case [["GATE"], ["SLIDER", param], ["FOCUS", "IN"]]:
self.window.nvda.speak(f"{param} {values[f'GATE||SLIDER {param}']}") label_map = {
"DAMPING": "Damping Max",
"BPSIDECHAIN": "BP Sidechain",
}
self.window.nvda.speak(f"{label_map.get(param, param)} {values[f'GATE||SLIDER {param}']}")
case [ case [
["GATE"], ["GATE"],
@ -522,7 +533,10 @@ class Popup:
setattr(self.window.vm.strip[index].gate, param.lower(), val) setattr(self.window.vm.strip[index].gate, param.lower(), val)
popup[f"GATE||SLIDER {param}"].update(value=val) popup[f"GATE||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1))) if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else: else:
self.window.vm.event.pdirty = True self.window.vm.event.pdirty = True
case [ case [
@ -544,7 +558,10 @@ class Popup:
setattr(self.window.vm.strip[index].gate, param.lower(), val) setattr(self.window.vm.strip[index].gate, param.lower(), val)
popup[f"GATE||SLIDER {param}"].update(value=val) popup[f"GATE||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1))) if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else: else:
self.window.vm.event.pdirty = True self.window.vm.event.pdirty = True
case [ case [
@ -566,10 +583,63 @@ class Popup:
setattr(self.window.vm.strip[index].gate, param.lower(), val) setattr(self.window.vm.strip[index].gate, param.lower(), val)
popup[f"GATE||SLIDER {param}"].update(value=val) popup[f"GATE||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1))) if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", "BPSIDECHAIN" | "ATTACK" | "HOLD" | "RELEASE" as param],
["KEY", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 10
case "LEFT" | "DOWN":
val -= 10
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", "BPSIDECHAIN" | "ATTACK" | "HOLD" | "RELEASE" as param],
["KEY", "CTRL", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 50
case "LEFT" | "DOWN":
val -= 50
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else: else:
self.window.vm.event.pdirty = True self.window.vm.event.pdirty = True
case [[button], ["FOCUS", "IN"]]:
self.window.nvda.speak(button)
case [_, ["KEY", "ENTER"]]: case [_, ["KEY", "ENTER"]]:
popup.find_element_with_focus().click() popup.find_element_with_focus().click()