mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2024-11-22 18:00:50 +00:00
start laying out parameter sliders.
This commit is contained in:
parent
719328c6de
commit
e0f36b2411
@ -6,6 +6,7 @@ from .util import (
|
|||||||
get_insert_checkbox_index,
|
get_insert_checkbox_index,
|
||||||
get_output_device_list,
|
get_output_device_list,
|
||||||
get_patch_composite_list,
|
get_patch_composite_list,
|
||||||
|
get_slider_params,
|
||||||
get_tabs_labels,
|
get_tabs_labels,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -327,9 +328,52 @@ class Builder:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
outputs = []
|
def add_param_sliders(layout):
|
||||||
[step(outputs) for step in (add_gain_slider,)]
|
def default_value(i, param):
|
||||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL||SLIDER")
|
target = getattr(self.vm.strip[i], param.lower())
|
||||||
|
if param in ("COMP", "GATE", "DENOISER"):
|
||||||
|
return target.knob
|
||||||
|
return target
|
||||||
|
|
||||||
|
layout.append(
|
||||||
|
[
|
||||||
|
psg.Slider(
|
||||||
|
range=(0, 10),
|
||||||
|
default_value=default_value(i, param),
|
||||||
|
resolution=0.1,
|
||||||
|
disable_number_display=True,
|
||||||
|
size=(12, 10),
|
||||||
|
expand_x=True,
|
||||||
|
enable_events=True,
|
||||||
|
orientation="horizontal",
|
||||||
|
key=f"STRIP {i}||SLIDER {param}",
|
||||||
|
)
|
||||||
|
for param in get_slider_params(i, self.vm)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
def add_limit_slider(layout):
|
||||||
|
layout.append(
|
||||||
|
[
|
||||||
|
psg.Slider(
|
||||||
|
range=(-40, 12),
|
||||||
|
default_value=self.vm.strip[i].limit,
|
||||||
|
resolution=0.1,
|
||||||
|
disable_number_display=True,
|
||||||
|
expand_x=True,
|
||||||
|
enable_events=True,
|
||||||
|
orientation="horizontal",
|
||||||
|
key=f"STRIP {i}||SLIDER LIMIT",
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
layout = []
|
||||||
|
steps = (add_gain_slider, add_param_sliders)
|
||||||
|
if self.kind.name in ("banana", "potato"):
|
||||||
|
steps += (add_limit_slider,)
|
||||||
|
[step(layout) for step in steps]
|
||||||
|
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], layout, key=f"STRIP {i}||LABEL||SLIDER")
|
||||||
|
|
||||||
def make_tab1_slider_rows(self) -> psg.Frame:
|
def make_tab1_slider_rows(self) -> psg.Frame:
|
||||||
layout = [[self.make_tab1_slider_row(i)] for i in range(self.kind.phys_in)]
|
layout = [[self.make_tab1_slider_row(i)] for i in range(self.kind.phys_in)]
|
||||||
@ -395,8 +439,45 @@ class Builder:
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def add_param_sliders(layout):
|
||||||
|
def default_value(i, param):
|
||||||
|
return getattr(self.vm.strip[i], param.lower())
|
||||||
|
|
||||||
|
layout.append(
|
||||||
|
[
|
||||||
|
psg.Slider(
|
||||||
|
range=(0, 10),
|
||||||
|
default_value=default_value(i, param),
|
||||||
|
resolution=0.1,
|
||||||
|
disable_number_display=True,
|
||||||
|
size=(12, 10),
|
||||||
|
expand_x=True,
|
||||||
|
enable_events=True,
|
||||||
|
orientation="horizontal",
|
||||||
|
key=f"STRIP {i}||SLIDER {param}",
|
||||||
|
)
|
||||||
|
for param in get_slider_params(i, self.vm)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
def add_limit_slider(layout):
|
||||||
|
layout.append(
|
||||||
|
[
|
||||||
|
psg.Slider(
|
||||||
|
range=(-40, 12),
|
||||||
|
default_value=self.vm.strip[i].limit,
|
||||||
|
resolution=0.1,
|
||||||
|
disable_number_display=True,
|
||||||
|
expand_x=True,
|
||||||
|
enable_events=True,
|
||||||
|
orientation="horizontal",
|
||||||
|
key=f"STRIP {i}||SLIDER LIMIT",
|
||||||
|
)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
outputs = []
|
outputs = []
|
||||||
[step(outputs) for step in (add_gain_slider,)]
|
[step(outputs) for step in (add_gain_slider, add_param_sliders, add_limit_slider)]
|
||||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL||SLIDER")
|
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL||SLIDER")
|
||||||
|
|
||||||
def make_tab2_slider_rows(self) -> psg.Frame:
|
def make_tab2_slider_rows(self) -> psg.Frame:
|
||||||
|
@ -130,10 +130,22 @@ def get_bus_modes(vm) -> list:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def check_bounds(val, bounds):
|
def check_bounds(val, bounds) -> int | float:
|
||||||
lower, upper = bounds
|
lower, upper = bounds
|
||||||
if val > upper:
|
if val > upper:
|
||||||
val = upper
|
val = upper
|
||||||
elif val < lower:
|
elif val < lower:
|
||||||
val = lower
|
val = lower
|
||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
def get_slider_params(i, vm) -> list:
|
||||||
|
if i < vm.kind.phys_in:
|
||||||
|
if vm.kind.name == "basic":
|
||||||
|
return ("AUDIBILITY",)
|
||||||
|
elif vm.kind.name == "banana":
|
||||||
|
return ("COMP", "GATE")
|
||||||
|
elif vm.kind.name == "potato":
|
||||||
|
return ("COMP", "GATE", "DENOISER")
|
||||||
|
else:
|
||||||
|
return ("BASS", "MID", "TREBLE")
|
||||||
|
@ -476,6 +476,8 @@ class NVDAVMWindow(psg.Window):
|
|||||||
filepath = Path(filepath)
|
filepath = Path(filepath)
|
||||||
self.vm.set("command.load", str(filepath))
|
self.vm.set("command.load", str(filepath))
|
||||||
self.logger.debug(f"loading config file from {filepath}")
|
self.logger.debug(f"loading config file from {filepath}")
|
||||||
|
for i in (25, 50): # for the benefit of the sliders
|
||||||
|
self.TKroot.after(i, self.on_pdirty)
|
||||||
self.TKroot.after(
|
self.TKroot.after(
|
||||||
200,
|
200,
|
||||||
self.nvda.speak,
|
self.nvda.speak,
|
||||||
|
Loading…
Reference in New Issue
Block a user