defines bass,mid,treble ctrl events

This commit is contained in:
onyx-and-iris 2023-09-17 12:23:04 +01:00
parent 6c54d28210
commit 42fad86905

View File

@ -754,8 +754,6 @@ class NVDAVMWindow(psg.Window):
match param: match param:
case "GAIN": case "GAIN":
val = self.vm.strip[int(index)].gain val = self.vm.strip[int(index)].gain
case "LIMIT":
val = self.vm.strip[int(index)].limit
case "COMP" | "GATE" | "DENOISER": case "COMP" | "GATE" | "DENOISER":
target = getattr(self.vm.strip[int(index)], param.lower()) target = getattr(self.vm.strip[int(index)], param.lower())
val = target.knob val = target.knob
@ -763,6 +761,8 @@ class NVDAVMWindow(psg.Window):
val = self.vm.strip[int(index)].audibility val = self.vm.strip[int(index)].audibility
case "BASS" | "MID" | "TREBLE": case "BASS" | "MID" | "TREBLE":
val = getattr(self.vm.strip[int(index)], param.lower()) val = getattr(self.vm.strip[int(index)], param.lower())
case "LIMIT":
val = self.vm.strip[int(index)].limit
match direction: match direction:
case "RIGHT" | "UP": case "RIGHT" | "UP":
@ -774,9 +774,6 @@ class NVDAVMWindow(psg.Window):
case "GAIN": case "GAIN":
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12)) self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-60, 12))) self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-60, 12)))
case "LIMIT":
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)))
case "COMP" | "GATE" | "DENOISER": case "COMP" | "GATE" | "DENOISER":
setattr(target, "knob", util.check_bounds(val, (0, 10))) setattr(target, "knob", 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)))
@ -786,9 +783,23 @@ class NVDAVMWindow(psg.Window):
case "BASS" | "MID" | "TREBLE": case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12))) 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))) self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case "LIMIT":
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)))
case [ case [
["STRIP", index], ["STRIP", index],
["SLIDER", "GAIN" | "COMP" | "GATE" | "DENOISER" | "LIMIT" | "BASS" | "MID" | "TREBLE" as param], [
"SLIDER",
"GAIN"
| "COMP"
| "GATE"
| "DENOISER"
| "AUDIBILITY"
| "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:
@ -797,17 +808,21 @@ class NVDAVMWindow(psg.Window):
case "COMP" | "GATE" | "DENOISER": case "COMP" | "GATE" | "DENOISER":
target = getattr(self.vm.strip[int(index)], param.lower()) target = getattr(self.vm.strip[int(index)], param.lower())
val = target.knob val = target.knob
case "AUDIBILITY":
val = self.vm.strip[int(index)].audibility
case "BASS" | "MID" | "TREBLE":
val = getattr(self.vm.strip[int(index)], param.lower())
case "LIMIT": case "LIMIT":
val = self.vm.strip[int(index)].limit val = self.vm.strip[int(index)].limit
match direction: match direction:
case "RIGHT" | "UP": case "RIGHT" | "UP":
if param in ("COMP", "GATE", "DENOISER", "BASS", "MID", "TREBLE"): if param in ("COMP", "GATE", "DENOISER", "AUDIBILITY", "BASS", "MID", "TREBLE"):
val += 1 val += 1
else: else:
val += 3 val += 3
case "LEFT" | "DOWN": case "LEFT" | "DOWN":
if param in ("COMP", "GATE", "DENOISER", "BASS", "MID", "TREBLE"): if param in ("COMP", "GATE", "DENOISER", "AUDIBILITY", "BASS", "MID", "TREBLE"):
val -= 1 val -= 1
else: else:
val -= 3 val -= 3
@ -819,6 +834,9 @@ class NVDAVMWindow(psg.Window):
case "COMP" | "GATE" | "DENOISER": case "COMP" | "GATE" | "DENOISER":
setattr(target, "knob", util.check_bounds(val, (0, 10))) setattr(target, "knob", 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 "AUDIBILITY":
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)))
case "BASS" | "MID" | "TREBLE": case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12))) 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))) self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
@ -827,7 +845,18 @@ class NVDAVMWindow(psg.Window):
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 [ 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", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction], ["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
]: ]:
match param: match param:
@ -838,6 +867,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())
case "LIMIT": case "LIMIT":
val = self.vm.strip[int(index)].limit val = self.vm.strip[int(index)].limit
@ -863,6 +894,9 @@ 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 "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)))