bass, mid, treble slider events defined

This commit is contained in:
onyx-and-iris 2023-09-17 11:44:15 +01:00
parent 1fdb39a041
commit 0570138963

View File

@ -674,7 +674,18 @@ class NVDAVMWindow(psg.Window):
# Strip Sliders # Strip Sliders
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" as param], [
"SLIDER",
"GAIN"
| "COMP"
| "GATE"
| "DENOISER"
| "AUDIBILITY"
| "LIMIT"
| "BASS"
| "MID"
| "TREBLE" as param,
],
]: ]:
label = self.cache["labels"][f"STRIP {index}||LABEL"] label = self.cache["labels"][f"STRIP {index}||LABEL"]
val = values[event] val = values[event]
@ -689,10 +700,23 @@ class NVDAVMWindow(psg.Window):
case "LIMIT": case "LIMIT":
val = int(val) val = int(val)
self.vm.strip[int(index)].limit = val self.vm.strip[int(index)].limit = val
case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), val)
self.nvda.speak(f"{label} {param} slider {val}") self.nvda.speak(f"{label} {param} slider {val}")
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" as param], [
"SLIDER",
"GAIN"
| "COMP"
| "GATE"
| "DENOISER"
| "AUDIBILITY"
| "LIMIT"
| "BASS"
| "MID"
| "TREBLE" as param,
],
["FOCUS", "IN"], ["FOCUS", "IN"],
]: ]:
if self.find_element_with_focus() is not None: if self.find_element_with_focus() is not None:
@ -710,7 +734,18 @@ class NVDAVMWindow(psg.Window):
self.vm.event.pdirty = True self.vm.event.pdirty = True
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" as param], [
"SLIDER",
"GAIN"
| "COMP"
| "GATE"
| "DENOISER"
| "AUDIBILITY"
| "LIMIT"
| "BASS"
| "MID"
| "TREBLE" as param,
],
["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction], ["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
]: ]:
match param: match param:
@ -723,6 +758,8 @@ class NVDAVMWindow(psg.Window):
val = target.knob val = target.knob
case "AUDIBILITY": case "AUDIBILITY":
val = self.vm.strip[int(index)].audibility val = self.vm.strip[int(index)].audibility
case "BASS" | "MID" | "TREBLE":
val = getattr(self.vm.strip[int(index)], param.lower())
match direction: match direction:
case "RIGHT" | "UP": case "RIGHT" | "UP":
@ -743,9 +780,12 @@ class NVDAVMWindow(psg.Window):
case "AUDIBILITY": case "AUDIBILITY":
self.vm.strip[int(index)].audibility = util.check_bounds(val, (0, 10)) self.vm.strip[int(index)].audibility = util.check_bounds(val, (0, 10))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10))) self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "LIMIT" as param], ["SLIDER", "GAIN" | "LIMIT" | "BASS" | "MID" | "TREBLE" as param],
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction], ["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
]: ]:
match param: match param:
@ -756,8 +796,14 @@ class NVDAVMWindow(psg.Window):
match direction: match direction:
case "RIGHT" | "UP": case "RIGHT" | "UP":
if param in ("BASS", "MID", "TREBLE"):
val += 1
else:
val += 3 val += 3
case "LEFT" | "DOWN": case "LEFT" | "DOWN":
if param in ("BASS", "MID", "TREBLE"):
val -= 1
else:
val -= 3 val -= 3
match param: match param:
@ -767,6 +813,9 @@ class NVDAVMWindow(psg.Window):
case "LIMIT": case "LIMIT":
self.vm.strip[int(index)].limit = util.check_bounds(val, (-40, 12)) self.vm.strip[int(index)].limit = util.check_bounds(val, (-40, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-40, 12))) self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-40, 12)))
case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" as param], ["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" as param],