Compare commits

..

No commits in common. "c385476cc472263489f0a8e8d72af12c630112a7" and "421688eff834ee2631a0923778ac6f2ec138fa94" have entirely different histories.

5 changed files with 43 additions and 39 deletions

View File

@ -1,6 +1,6 @@
[project] [project]
name = "nvda_voicemeeter" name = "nvda_voicemeeter"
version = "0.5.5" version = "0.5.3"
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

@ -381,7 +381,7 @@ class Builder:
if i == self.kind.phys_in + 1: if i == self.kind.phys_in + 1:
layout.append( layout.append(
[ [
psg.Button("K", size=(6, 2), key=f"STRIP {i}||KARAOKE"), psg.Button("K", size=(6, 2), key=f"STRIP {i}||MONO"),
psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"), psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"),
psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"), psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"),
], ],
@ -389,7 +389,7 @@ class Builder:
else: else:
layout.append( layout.append(
[ [
psg.Button("MC", size=(6, 2), key=f"STRIP {i}||MC"), psg.Button("MC", size=(6, 2), key=f"STRIP {i}||MONO"),
psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"), psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"),
psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"), psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"),
], ],

View File

@ -38,15 +38,10 @@ def _make_param_cache(vm, channel_type) -> dict:
**{f"STRIP {i}||B3": vm.strip[i].B3 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B3": vm.strip[i].B3 for i in range(vm.kind.num_strip)},
} }
params |= { params |= {
**{f"STRIP {i}||MONO": vm.strip[i].mono for i in range(vm.kind.phys_in)}, **{f"STRIP {i}||MONO": vm.strip[i].mono for i in range(vm.kind.num_strip)},
**{f"STRIP {i}||SOLO": vm.strip[i].solo for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||SOLO": vm.strip[i].solo for i in range(vm.kind.num_strip)},
**{f"STRIP {i}||MUTE": vm.strip[i].mute for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||MUTE": vm.strip[i].mute for i in range(vm.kind.num_strip)},
} }
for i in range(vm.kind.phys_in, vm.kind.phys_in + vm.kind.virt_in):
if i == vm.kind.phys_in + 1:
params[f"STRIP {i}||KARAOKE"] = vm.strip[i].k
else:
params[f"STRIP {i}||MC"] = vm.strip[i].mc
else: else:
params |= { params |= {
**{f"BUS {i}||MONO": vm.bus[i].mono for i in range(vm.kind.num_bus)}, **{f"BUS {i}||MONO": vm.bus[i].mono for i in range(vm.kind.num_bus)},

View File

@ -192,7 +192,3 @@ def get_slider_modes() -> Iterable:
"DENOISER MODE", "DENOISER MODE",
"LIMIT MODE", "LIMIT MODE",
) )
def _get_bus_assignments(kind) -> list:
return [f"A{i}" for i in range(1, kind.phys_out + 1)] + [f"B{i}" for i in range(1, kind.virt_out + 1)]

View File

@ -237,14 +237,9 @@ class NVDAVMWindow(psg.Window):
self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN") self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER") self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
else: else:
if i == self.kind.phys_in + 1: for param in ("MONO", "SOLO", "MUTE"):
for param in ("KARAOKE", "SOLO", "MUTE"): self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN") self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
else:
for param in ("MC", "SOLO", "MUTE"):
self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
# Strip Sliders # Strip Sliders
for i in range(self.kind.num_strip): for i in range(self.kind.num_strip):
@ -664,36 +659,54 @@ class NVDAVMWindow(psg.Window):
# Strip Params # Strip Params
case [["STRIP", index], [param]]: case [["STRIP", index], [param]]:
label = self.cache["labels"][f"STRIP {index}||LABEL"]
match param: match param:
case "KARAOKE": case "MONO":
opts = ["off", "k m", "k 1", "k 2", "k v"] if int(index) < self.kind.phys_in:
next_val = self.vm.strip[int(index)].k + 1 actual = param.lower()
if next_val == len(opts): elif int(index) == self.kind.phys_in + 1:
next_val = 0 actual = "k"
self.vm.strip[int(index)].k = next_val else:
self.cache["strip"][f"STRIP {index}||{param}"] = next_val actual = "mc"
self.nvda.speak(opts[next_val]) phonetic = {"k": "karaoke"}
case output if param in util._get_bus_assignments(self.kind): if actual == "k":
val = not self.cache["strip"][f"STRIP {index}||{output}"] next_val = self.vm.strip[int(index)].k + 1
setattr(self.vm.strip[int(index)], output, val) if next_val == 4:
self.cache["strip"][f"STRIP {index}||{output}"] = val next_val = 0
self.nvda.speak("on" if val else "off") setattr(self.vm.strip[int(index)], actual, next_val)
self.cache["strip"][f"STRIP {index}||{param}"] = next_val
self.nvda.speak(["off", "k m", "k 1", "k 2"][next_val])
else:
val = not self.cache["strip"][f"STRIP {index}||{param}"]
setattr(self.vm.strip[int(index)], actual, val)
self.cache["strip"][f"STRIP {index}||{param}"] = val
self.nvda.speak("on" if val else "off")
case _: case _:
val = not self.cache["strip"][f"STRIP {index}||{param}"] val = not self.cache["strip"][f"STRIP {index}||{param}"]
setattr(self.vm.strip[int(index)], param.lower(), val) setattr(self.vm.strip[int(index)], param if param[0] in ("A", "B") else param.lower(), val)
self.cache["strip"][f"STRIP {index}||{param}"] = val self.cache["strip"][f"STRIP {index}||{param}"] = val
self.nvda.speak("on" if val else "off") self.nvda.speak("on" if val else "off")
case [["STRIP", index], [param], ["FOCUS", "IN"]]: case [["STRIP", index], [param], ["FOCUS", "IN"]]:
if self.find_element_with_focus() is not None: if self.find_element_with_focus() is not None:
val = self.cache["strip"][f"STRIP {index}||{param}"] val = self.cache["strip"][f"STRIP {index}||{param}"]
phonetic = {"KARAOKE": "karaoke"} match param:
case "MONO":
if int(index) < self.kind.phys_in:
actual = param.lower()
elif int(index) == self.kind.phys_in + 1:
actual = "k"
else:
actual = "mc"
case _:
actual = param
phonetic = {"k": "karaoke"}
label = self.cache["labels"][f"STRIP {index}||LABEL"] label = self.cache["labels"][f"STRIP {index}||LABEL"]
if param == "KARAOKE": if actual == "k":
self.nvda.speak( self.nvda.speak(
f"{label} {phonetic.get(param, param)} {['off', 'k m', 'k 1', 'k 2', 'k v'][self.cache['strip'][f'STRIP {int(index)}||{param}']]}" f"{label} {phonetic.get(actual, actual)} {['off', 'k m', 'k 1', 'k 2'][self.cache['strip'][f'STRIP {int(index)}||{param}']]}"
) )
else: else:
self.nvda.speak(f"{label} {phonetic.get(param, param)} {'on' if val else 'off'}") self.nvda.speak(f"{label} {phonetic.get(actual, actual)} {'on' if val else 'off'}")
case [["STRIP", index], [param], ["KEY", "ENTER"]]: case [["STRIP", index], [param], ["KEY", "ENTER"]]:
self.find_element_with_focus().click() self.find_element_with_focus().click()