adds bass, mid and treble slider modes

patch bump
This commit is contained in:
onyx-and-iris 2023-09-21 09:33:22 +01:00
parent 4ca64f94bc
commit 3ca9e14e96
5 changed files with 33 additions and 21 deletions

View File

@ -143,6 +143,9 @@ You may also enter slider modes which allow for control of the channels sliders
- `Control + G` will enter Gain mode
- `Control + T` will enter Gate mode
- `Control + L` will enter Limit mode
- `Control + B` will enter Bass mode
- `Control + I` will enter Mid mode
- `Control + R` will enter Treble mode
To exit any of the slider modes press `Escape`.

View File

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

View File

@ -323,7 +323,7 @@ class Builder:
)
def add_param_sliders(layout):
layout.append([LabelSlider(self.window, i, param) for param in util.get_slider_params(i, self.vm)])
layout.append([LabelSlider(self.window, i, param) for param in util.get_slider_params(i, self.kind)])
def add_limit_slider(layout):
layout.append(
@ -416,13 +416,13 @@ class Builder:
def add_param_sliders(layout):
if self.kind.name in ("basic", "banana"):
for param in util.get_slider_params(i, self.vm):
for param in util.get_slider_params(i, self.kind):
layout.append([LabelSlider(self.window, i, param, range_=(-12, 12))])
else:
layout.append(
[
LabelSlider(self.window, i, param, range_=(-12, 12))
for param in util.get_slider_params(i, self.vm)
for param in util.get_slider_params(i, self.kind)
]
)

View File

@ -141,12 +141,19 @@ def check_bounds(val, bounds: tuple) -> int | float:
return val
def get_slider_params(i, vm) -> Iterable:
if i < vm.kind.phys_in:
if vm.kind.name == "basic":
def get_slider_params(i, kind) -> Iterable:
if i < kind.phys_in:
if kind.name == "basic":
return ("AUDIBILITY",)
if vm.kind.name == "banana":
if kind.name == "banana":
return ("COMP", "GATE")
if vm.kind.name == "potato":
if kind.name == "potato":
return ("COMP", "GATE", "DENOISER")
return ("BASS", "MID", "TREBLE")
def get_full_slider_params(i, kind) -> Iterable:
params = list(get_slider_params(i, kind) + ("GAIN", "LIMIT"))
if kind.name == "basic":
params.remove("LIMIT")
return params

View File

@ -50,7 +50,7 @@ class NVDAVMWindow(psg.Window):
[self[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(**buttonmenu_opts) for i in range(self.kind.phys_out)]
slider_opts = {"takefocus": 1, "highlightthickness": 1}
for i in range(self.kind.num_strip):
for param in util.get_slider_params(i, self.vm):
for param in util.get_slider_params(i, self.kind):
self[f"STRIP {i}||SLIDER {param}"].Widget.config(**slider_opts)
self[f"STRIP {i}||SLIDER GAIN"].Widget.config(**slider_opts)
if self.kind.name != "basic":
@ -109,7 +109,7 @@ class NVDAVMWindow(psg.Window):
self[f"STRIP {i}||SLIDER GAIN"].update(value=self.vm.strip[i].gain)
if self.kind.name != "basic":
self[f"STRIP {i}||SLIDER LIMIT"].update(value=self.vm.strip[i].limit)
for param in util.get_slider_params(i, self.vm):
for param in util.get_slider_params(i, self.kind):
if param in ("AUDIBILITY", "BASS", "MID", "TREBLE"):
val = getattr(self.vm.strip[i], param.lower())
else:
@ -148,16 +148,18 @@ class NVDAVMWindow(psg.Window):
self.bind("<Control-o>", "CTRL-O")
self.bind("<Control-s>", "CTRL-S")
self.bind("<Control-m>", "CTRL-M")
self.bind("<Control-g>", "GAIN MODE")
self.bind("<Control-b>", "BASS MODE")
self.bind("<Control-i>", "MID MODE")
self.bind("<Control-r>", "TREBLE MODE")
if self.kind.name == "basic":
self.bind("<Control-u>", "AUDIBILITY MODE")
self.bind("<Control-g>", "GAIN MODE")
elif self.kind.name == "banana":
self.bind("<Control-g>", "GAIN MODE")
self.bind("<Control-c>", "COMP MODE")
self.bind("<Control-t>", "GATE MODE")
self.bind("<Control-l>", "LIMIT MODE")
else:
self.bind("<Control-g>", "GAIN MODE")
self.bind("<Control-c>", "COMP MODE")
self.bind("<Control-t>", "GATE MODE")
self.bind("<Control-d>", "DENOISER MODE")
@ -231,9 +233,7 @@ class NVDAVMWindow(psg.Window):
# Strip Sliders
for i in range(self.kind.num_strip):
for param in util.get_slider_params(i, self.vm) + ("GAIN", "LIMIT"):
if self.kind.name == "basic" and param == "LIMIT":
continue
for param in util.get_full_slider_params(i, self.kind):
self[f"STRIP {i}||SLIDER {param}"].bind("<FocusIn>", "||FOCUS IN")
self[f"STRIP {i}||SLIDER {param}"].bind("<FocusOut>", "||FOCUS OUT")
self[f"STRIP {i}||SLIDER {param}"].bind("<Left>", "||KEY LEFT")
@ -291,7 +291,7 @@ class NVDAVMWindow(psg.Window):
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Exit"):
break
elif event in ("GAIN MODE", "COMP MODE", "GATE MODE", "DENOISER MODE", "LIMIT MODE"):
elif event.endswith("MODE"):
mode = event
self.nvda.speak(f"{mode} enabled")
elif event == "Escape:27":
@ -385,6 +385,8 @@ class NVDAVMWindow(psg.Window):
param = values[event]
if focus := self.find_element_with_focus():
identifier, partial = focus.Key.split("||")
_, index = identifier.split()
if param in util.get_full_slider_params(int(index), self.kind):
if "SLIDER" not in partial:
op = op.removeprefix("SLIDER-MODE-").split("-")
self.write_event_value(f"{identifier}||SLIDER {param}||KEY {' '.join(op)}", None)