mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2024-11-22 18:00:50 +00:00
upd type annotations
cleanup global namespace.
This commit is contained in:
parent
e0f36b2411
commit
d93f078365
@ -1,14 +1,6 @@
|
|||||||
import PySimpleGUI as psg
|
import PySimpleGUI as psg
|
||||||
|
|
||||||
from .util import (
|
from . import util
|
||||||
get_asio_checkbox_index,
|
|
||||||
get_input_device_list,
|
|
||||||
get_insert_checkbox_index,
|
|
||||||
get_output_device_list,
|
|
||||||
get_patch_composite_list,
|
|
||||||
get_slider_params,
|
|
||||||
get_tabs_labels,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class Builder:
|
class Builder:
|
||||||
@ -92,7 +84,7 @@ class Builder:
|
|||||||
return psg.Tab(identifier, [[tabgroup]], key=f"tab||{identifier}")
|
return psg.Tab(identifier, [[tabgroup]], key=f"tab||{identifier}")
|
||||||
|
|
||||||
tabs = []
|
tabs = []
|
||||||
for tab in get_tabs_labels():
|
for tab in util.get_tabs_labels():
|
||||||
tabs.append(_make_tabs(tab))
|
tabs.append(_make_tabs(tab))
|
||||||
|
|
||||||
tab_group = psg.TabGroup([tabs], change_submits=True, enable_events=True, key="tabgroup")
|
tab_group = psg.TabGroup([tabs], change_submits=True, enable_events=True, key="tabgroup")
|
||||||
@ -117,7 +109,7 @@ class Builder:
|
|||||||
"""tab0 row0 represents hardware ins"""
|
"""tab0 row0 represents hardware ins"""
|
||||||
|
|
||||||
def add_physical_device_opts(layout):
|
def add_physical_device_opts(layout):
|
||||||
devices = get_input_device_list(self.vm)
|
devices = util.get_input_device_list(self.vm)
|
||||||
devices.append("- remove device selection -")
|
devices.append("- remove device selection -")
|
||||||
layout.append(
|
layout.append(
|
||||||
[
|
[
|
||||||
@ -148,7 +140,7 @@ class Builder:
|
|||||||
psg.ButtonMenu(
|
psg.ButtonMenu(
|
||||||
f"A{i + 1}",
|
f"A{i + 1}",
|
||||||
size=(6, 3),
|
size=(6, 3),
|
||||||
menu_def=["", get_output_device_list(i, self.vm)],
|
menu_def=["", util.get_output_device_list(i, self.vm)],
|
||||||
key=f"HARDWARE OUT||A{i + 1}",
|
key=f"HARDWARE OUT||A{i + 1}",
|
||||||
)
|
)
|
||||||
for i in range(num_outs)
|
for i in range(num_outs)
|
||||||
@ -168,7 +160,7 @@ class Builder:
|
|||||||
[
|
[
|
||||||
psg.Spin(
|
psg.Spin(
|
||||||
nums,
|
nums,
|
||||||
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{get_asio_checkbox_index(0, i)}"],
|
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{util.get_asio_checkbox_index(0, i)}"],
|
||||||
size=2,
|
size=2,
|
||||||
enable_events=True,
|
enable_events=True,
|
||||||
key=f"ASIO CHECKBOX||IN{i} 0",
|
key=f"ASIO CHECKBOX||IN{i} 0",
|
||||||
@ -179,7 +171,7 @@ class Builder:
|
|||||||
[
|
[
|
||||||
psg.Spin(
|
psg.Spin(
|
||||||
nums,
|
nums,
|
||||||
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{get_asio_checkbox_index(1, i)}"],
|
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{util.get_asio_checkbox_index(1, i)}"],
|
||||||
size=2,
|
size=2,
|
||||||
enable_events=True,
|
enable_events=True,
|
||||||
key=f"ASIO CHECKBOX||IN{i} 1",
|
key=f"ASIO CHECKBOX||IN{i} 1",
|
||||||
@ -200,7 +192,7 @@ class Builder:
|
|||||||
"""tab0 row3 represents patch composite"""
|
"""tab0 row3 represents patch composite"""
|
||||||
|
|
||||||
def add_physical_device_opts(layout):
|
def add_physical_device_opts(layout):
|
||||||
outputs = get_patch_composite_list(self.vm.kind)
|
outputs = util.get_patch_composite_list(self.vm.kind)
|
||||||
layout.append(
|
layout.append(
|
||||||
[
|
[
|
||||||
psg.ButtonMenu(
|
psg.ButtonMenu(
|
||||||
@ -227,7 +219,7 @@ class Builder:
|
|||||||
[
|
[
|
||||||
psg.Checkbox(
|
psg.Checkbox(
|
||||||
text=channel,
|
text=channel,
|
||||||
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
|
default=self.vm.patch.insert[util.get_insert_checkbox_index(self.kind, j, i)].on,
|
||||||
enable_events=True,
|
enable_events=True,
|
||||||
key=f"INSERT CHECKBOX||IN{i} {j}",
|
key=f"INSERT CHECKBOX||IN{i} {j}",
|
||||||
)
|
)
|
||||||
@ -240,7 +232,7 @@ class Builder:
|
|||||||
[
|
[
|
||||||
psg.Checkbox(
|
psg.Checkbox(
|
||||||
text=channel,
|
text=channel,
|
||||||
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
|
default=self.vm.patch.insert[util.get_insert_checkbox_index(self.kind, j, i)].on,
|
||||||
enable_events=True,
|
enable_events=True,
|
||||||
key=f"INSERT CHECKBOX||IN{i} {j}",
|
key=f"INSERT CHECKBOX||IN{i} {j}",
|
||||||
)
|
)
|
||||||
@ -348,7 +340,7 @@ class Builder:
|
|||||||
orientation="horizontal",
|
orientation="horizontal",
|
||||||
key=f"STRIP {i}||SLIDER {param}",
|
key=f"STRIP {i}||SLIDER {param}",
|
||||||
)
|
)
|
||||||
for param in get_slider_params(i, self.vm)
|
for param in util.get_slider_params(i, self.vm)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -456,7 +448,7 @@ class Builder:
|
|||||||
orientation="horizontal",
|
orientation="horizontal",
|
||||||
key=f"STRIP {i}||SLIDER {param}",
|
key=f"STRIP {i}||SLIDER {param}",
|
||||||
)
|
)
|
||||||
for param in get_slider_params(i, self.vm)
|
for param in util.get_slider_params(i, self.vm)
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
from typing import Iterable
|
||||||
|
|
||||||
|
|
||||||
def get_asio_checkbox_index(channel, num) -> int:
|
def get_asio_checkbox_index(channel, num) -> int:
|
||||||
if channel == 0:
|
if channel == 0:
|
||||||
return 2 * num - 2
|
return 2 * num - 2
|
||||||
@ -8,7 +11,6 @@ def get_insert_checkbox_index(kind, channel, num) -> int:
|
|||||||
if num <= kind.phys_in:
|
if num <= kind.phys_in:
|
||||||
if channel == 0:
|
if channel == 0:
|
||||||
return 2 * num - 2
|
return 2 * num - 2
|
||||||
else:
|
|
||||||
return 2 * num - 1
|
return 2 * num - 1
|
||||||
return (2 * kind.phys_in) + (8 * (num - kind.phys_in - 1)) + channel
|
return (2 * kind.phys_in) + (8 * (num - kind.phys_in - 1)) + channel
|
||||||
|
|
||||||
@ -130,7 +132,7 @@ def get_bus_modes(vm) -> list:
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def check_bounds(val, bounds) -> int | float:
|
def check_bounds(val, bounds: tuple) -> int | float:
|
||||||
lower, upper = bounds
|
lower, upper = bounds
|
||||||
if val > upper:
|
if val > upper:
|
||||||
val = upper
|
val = upper
|
||||||
@ -139,13 +141,12 @@ def check_bounds(val, bounds) -> int | float:
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
def get_slider_params(i, vm) -> list:
|
def get_slider_params(i, vm) -> Iterable:
|
||||||
if i < vm.kind.phys_in:
|
if i < vm.kind.phys_in:
|
||||||
if vm.kind.name == "basic":
|
if vm.kind.name == "basic":
|
||||||
return ("AUDIBILITY",)
|
return ("AUDIBILITY",)
|
||||||
elif vm.kind.name == "banana":
|
if vm.kind.name == "banana":
|
||||||
return ("COMP", "GATE")
|
return ("COMP", "GATE")
|
||||||
elif vm.kind.name == "potato":
|
if vm.kind.name == "potato":
|
||||||
return ("COMP", "GATE", "DENOISER")
|
return ("COMP", "GATE", "DENOISER")
|
||||||
else:
|
|
||||||
return ("BASS", "MID", "TREBLE")
|
return ("BASS", "MID", "TREBLE")
|
||||||
|
@ -4,29 +4,10 @@ from pathlib import Path
|
|||||||
|
|
||||||
import PySimpleGUI as psg
|
import PySimpleGUI as psg
|
||||||
|
|
||||||
|
from . import models, util
|
||||||
from .builder import Builder
|
from .builder import Builder
|
||||||
from .models import (
|
|
||||||
_make_hardware_ins_cache,
|
|
||||||
_make_hardware_outs_cache,
|
|
||||||
_make_label_cache,
|
|
||||||
_make_param_cache,
|
|
||||||
_make_patch_asio_cache,
|
|
||||||
_make_patch_insert_cache,
|
|
||||||
)
|
|
||||||
from .nvda import Nvda
|
from .nvda import Nvda
|
||||||
from .parser import Parser
|
from .parser import Parser
|
||||||
from .util import (
|
|
||||||
_patch_insert_channels,
|
|
||||||
check_bounds,
|
|
||||||
get_asio_checkbox_index,
|
|
||||||
get_asio_samples_list,
|
|
||||||
get_bus_modes,
|
|
||||||
get_channel_identifier_list,
|
|
||||||
get_insert_checkbox_index,
|
|
||||||
get_patch_composite_list,
|
|
||||||
get_tabs_labels,
|
|
||||||
open_context_menu_for_buttonmenu,
|
|
||||||
)
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -43,13 +24,13 @@ class NVDAVMWindow(psg.Window):
|
|||||||
self.kind = self.vm.kind
|
self.kind = self.vm.kind
|
||||||
self.logger = logger.getChild(type(self).__name__)
|
self.logger = logger.getChild(type(self).__name__)
|
||||||
self.cache = {
|
self.cache = {
|
||||||
"hw_ins": _make_hardware_ins_cache(self.vm),
|
"hw_ins": models._make_hardware_ins_cache(self.vm),
|
||||||
"hw_outs": _make_hardware_outs_cache(self.vm),
|
"hw_outs": models._make_hardware_outs_cache(self.vm),
|
||||||
"strip": _make_param_cache(self.vm, "strip"),
|
"strip": models._make_param_cache(self.vm, "strip"),
|
||||||
"bus": _make_param_cache(self.vm, "bus"),
|
"bus": models._make_param_cache(self.vm, "bus"),
|
||||||
"labels": _make_label_cache(self.vm),
|
"labels": models._make_label_cache(self.vm),
|
||||||
"asio": _make_patch_asio_cache(self.vm),
|
"asio": models._make_patch_asio_cache(self.vm),
|
||||||
"insert": _make_patch_insert_cache(self.vm),
|
"insert": models._make_patch_insert_cache(self.vm),
|
||||||
}
|
}
|
||||||
self.nvda = Nvda()
|
self.nvda = Nvda()
|
||||||
self.parser = Parser()
|
self.parser = Parser()
|
||||||
@ -107,13 +88,13 @@ class NVDAVMWindow(psg.Window):
|
|||||||
|
|
||||||
def on_pdirty(self):
|
def on_pdirty(self):
|
||||||
self.cache = {
|
self.cache = {
|
||||||
"hw_ins": _make_hardware_ins_cache(self.vm),
|
"hw_ins": models._make_hardware_ins_cache(self.vm),
|
||||||
"hw_outs": _make_hardware_outs_cache(self.vm),
|
"hw_outs": models._make_hardware_outs_cache(self.vm),
|
||||||
"strip": _make_param_cache(self.vm, "strip"),
|
"strip": models._make_param_cache(self.vm, "strip"),
|
||||||
"bus": _make_param_cache(self.vm, "bus"),
|
"bus": models._make_param_cache(self.vm, "bus"),
|
||||||
"labels": _make_label_cache(self.vm),
|
"labels": models._make_label_cache(self.vm),
|
||||||
"asio": _make_patch_asio_cache(self.vm),
|
"asio": models._make_patch_asio_cache(self.vm),
|
||||||
"insert": _make_patch_insert_cache(self.vm),
|
"insert": models._make_patch_insert_cache(self.vm),
|
||||||
}
|
}
|
||||||
for key, value in self.cache["labels"].items():
|
for key, value in self.cache["labels"].items():
|
||||||
self[key].update(value=value)
|
self[key].update(value=value)
|
||||||
@ -125,11 +106,11 @@ class NVDAVMWindow(psg.Window):
|
|||||||
if self.kind.name != "basic":
|
if self.kind.name != "basic":
|
||||||
for key, value in self.cache["asio"].items():
|
for key, value in self.cache["asio"].items():
|
||||||
identifier, i = key.split("||")
|
identifier, i = key.split("||")
|
||||||
partial = get_channel_identifier_list(self.vm)[int(i)]
|
partial = util.get_channel_identifier_list(self.vm)[int(i)]
|
||||||
self[f"{identifier}||{partial}"].update(value=value)
|
self[f"{identifier}||{partial}"].update(value=value)
|
||||||
for key, value in self.cache["insert"].items():
|
for key, value in self.cache["insert"].items():
|
||||||
identifier, i = key.split("||")
|
identifier, i = key.split("||")
|
||||||
partial = get_channel_identifier_list(self.vm)[int(i)]
|
partial = util.get_channel_identifier_list(self.vm)[int(i)]
|
||||||
self[f"{identifier}||{partial}"].update(value=value)
|
self[f"{identifier}||{partial}"].update(value=value)
|
||||||
|
|
||||||
def register_events(self):
|
def register_events(self):
|
||||||
@ -137,7 +118,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
|
|
||||||
# TABS
|
# TABS
|
||||||
self["tabgroup"].bind("<FocusIn>", "||FOCUS IN")
|
self["tabgroup"].bind("<FocusIn>", "||FOCUS IN")
|
||||||
for tabname in get_tabs_labels()[1:]:
|
for tabname in util.get_tabs_labels()[1:]:
|
||||||
self[f"tabgroup||{tabname}"].bind("<FocusIn>", "||FOCUS IN")
|
self[f"tabgroup||{tabname}"].bind("<FocusIn>", "||FOCUS IN")
|
||||||
self[f"tabgroup||{tabname}"].bind("<Shift-KeyPress-Tab>", "||KEY SHIFT TAB")
|
self[f"tabgroup||{tabname}"].bind("<Shift-KeyPress-Tab>", "||KEY SHIFT TAB")
|
||||||
self.bind("<Control-KeyPress-Tab>", "CTRL-TAB")
|
self.bind("<Control-KeyPress-Tab>", "CTRL-TAB")
|
||||||
@ -339,7 +320,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
psg.ButtonMenu(
|
psg.ButtonMenu(
|
||||||
driver,
|
driver,
|
||||||
size=(14, 2),
|
size=(14, 2),
|
||||||
menu_def=["", get_asio_samples_list(driver)],
|
menu_def=["", util.get_asio_samples_list(driver)],
|
||||||
key=f"BUFFER {driver}",
|
key=f"BUFFER {driver}",
|
||||||
)
|
)
|
||||||
for driver in ("MME", "WDM", "KS", "ASIO")
|
for driver in ("MME", "WDM", "KS", "ASIO")
|
||||||
@ -386,7 +367,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val = int(self.vm.get(f"option.buffer.{driver.lower()}"))
|
val = int(self.vm.get(f"option.buffer.{driver.lower()}"))
|
||||||
self.nvda.speak(f"{driver} BUFFER {val if val else 'default'}")
|
self.nvda.speak(f"{driver} BUFFER {val if val else 'default'}")
|
||||||
case [["BUFFER", driver], ["KEY", "SPACE" | "ENTER"]]:
|
case [["BUFFER", driver], ["KEY", "SPACE" | "ENTER"]]:
|
||||||
open_context_menu_for_buttonmenu(window, f"BUFFER {driver}")
|
util.open_context_menu_for_buttonmenu(window, f"BUFFER {driver}")
|
||||||
case [[button], ["FOCUS", "IN"]]:
|
case [[button], ["FOCUS", "IN"]]:
|
||||||
self.nvda.speak(button)
|
self.nvda.speak(button)
|
||||||
case [[button], ["KEY", "ENTER"]]:
|
case [[button], ["KEY", "ENTER"]]:
|
||||||
@ -424,21 +405,21 @@ class NVDAVMWindow(psg.Window):
|
|||||||
index = int(data["Index"]) - 1
|
index = int(data["Index"]) - 1
|
||||||
match tab:
|
match tab:
|
||||||
case "Physical Strip":
|
case "Physical Strip":
|
||||||
label = data.get("Edit") or f"Hardware Input {index + 1}"
|
label = data.get("Edit", f"Hardware Input {index + 1}")
|
||||||
self.vm.strip[index].label = label
|
self.vm.strip[index].label = label
|
||||||
self[f"STRIP {index}||LABEL"].update(value=label)
|
self[f"STRIP {index}||LABEL"].update(value=label)
|
||||||
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
||||||
case "Virtual Strip":
|
case "Virtual Strip":
|
||||||
index += self.kind.phys_in
|
index += self.kind.phys_in
|
||||||
label = data.get("Edit") or f"Virtual Input {index - self.kind.phys_in + 1}"
|
label = data.get("Edit", f"Virtual Input {index - self.kind.phys_in + 1}")
|
||||||
self.vm.strip[index].label = label
|
self.vm.strip[index].label = label
|
||||||
self[f"STRIP {index}||LABEL"].update(value=label)
|
self[f"STRIP {index}||LABEL"].update(value=label)
|
||||||
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
||||||
case "Buses":
|
case "Buses":
|
||||||
if index < self.kind.phys_out:
|
if index < self.kind.phys_out:
|
||||||
label = data.get("Edit") or f"Physical Bus {index + 1}"
|
label = data.get("Edit", f"Physical Bus {index + 1}")
|
||||||
else:
|
else:
|
||||||
label = data.get("Edit") or f"Virtual Bus {index - self.kind.phys_out + 1}"
|
label = data.get("Edit", f"Virtual Bus {index - self.kind.phys_out + 1}")
|
||||||
self.vm.bus[index].label = label
|
self.vm.bus[index].label = label
|
||||||
self[f"BUS {index}||LABEL"].update(value=label)
|
self[f"BUS {index}||LABEL"].update(value=label)
|
||||||
self.cache["labels"][f"BUS {index}||LABEL"] = label
|
self.cache["labels"][f"BUS {index}||LABEL"] = label
|
||||||
@ -536,7 +517,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
if self.find_element_with_focus() is not None:
|
if self.find_element_with_focus() is not None:
|
||||||
self.nvda.speak(f"HARDWARE INPUT {key} {self.cache['hw_ins'][f'HARDWARE IN||{key}']}")
|
self.nvda.speak(f"HARDWARE INPUT {key} {self.cache['hw_ins'][f'HARDWARE IN||{key}']}")
|
||||||
case [["HARDWARE", "IN"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
case [["HARDWARE", "IN"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
||||||
open_context_menu_for_buttonmenu(self, f"HARDWARE IN||{key}")
|
util.open_context_menu_for_buttonmenu(self, f"HARDWARE IN||{key}")
|
||||||
|
|
||||||
# Hardware out
|
# Hardware out
|
||||||
case [["HARDWARE", "OUT"], [key]]:
|
case [["HARDWARE", "OUT"], [key]]:
|
||||||
@ -558,11 +539,11 @@ class NVDAVMWindow(psg.Window):
|
|||||||
if self.find_element_with_focus() is not None:
|
if self.find_element_with_focus() is not None:
|
||||||
self.nvda.speak(f"HARDWARE OUT {key} {self.cache['hw_outs'][f'HARDWARE OUT||{key}']}")
|
self.nvda.speak(f"HARDWARE OUT {key} {self.cache['hw_outs'][f'HARDWARE OUT||{key}']}")
|
||||||
case [["HARDWARE", "OUT"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
case [["HARDWARE", "OUT"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
||||||
open_context_menu_for_buttonmenu(self, f"HARDWARE OUT||{key}")
|
util.open_context_menu_for_buttonmenu(self, f"HARDWARE OUT||{key}")
|
||||||
|
|
||||||
# Patch ASIO
|
# Patch ASIO
|
||||||
case [["ASIO", "CHECKBOX"], [in_num, channel]]:
|
case [["ASIO", "CHECKBOX"], [in_num, channel]]:
|
||||||
index = get_asio_checkbox_index(int(channel), int(in_num[-1]))
|
index = util.get_asio_checkbox_index(int(channel), int(in_num[-1]))
|
||||||
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
|
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
|
||||||
self.vm.patch.asio[index].set(val)
|
self.vm.patch.asio[index].set(val)
|
||||||
channel = ("left", "right")[int(channel)]
|
channel = ("left", "right")[int(channel)]
|
||||||
@ -578,7 +559,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
case [["PATCH", "COMPOSITE"], [key]]:
|
case [["PATCH", "COMPOSITE"], [key]]:
|
||||||
val = values[f"PATCH COMPOSITE||{key}"]
|
val = values[f"PATCH COMPOSITE||{key}"]
|
||||||
index = int(key[-1]) - 1
|
index = int(key[-1]) - 1
|
||||||
self.vm.patch.composite[index].set(get_patch_composite_list(self.kind).index(val) + 1)
|
self.vm.patch.composite[index].set(util.get_patch_composite_list(self.kind).index(val) + 1)
|
||||||
self.TKroot.after(200, self.nvda.speak, f"PATCH COMPOSITE {key[-1]} set {val}")
|
self.TKroot.after(200, self.nvda.speak, f"PATCH COMPOSITE {key[-1]} set {val}")
|
||||||
case [["PATCH", "COMPOSITE"], [key], ["FOCUS", "IN"]]:
|
case [["PATCH", "COMPOSITE"], [key], ["FOCUS", "IN"]]:
|
||||||
if self.find_element_with_focus() is not None:
|
if self.find_element_with_focus() is not None:
|
||||||
@ -586,14 +567,14 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val = values[f"PATCH COMPOSITE||{key}"]
|
val = values[f"PATCH COMPOSITE||{key}"]
|
||||||
else:
|
else:
|
||||||
index = int(key[-1]) - 1
|
index = int(key[-1]) - 1
|
||||||
val = get_patch_composite_list(self.kind)[self.vm.patch.composite[index].get() - 1]
|
val = util.get_patch_composite_list(self.kind)[self.vm.patch.composite[index].get() - 1]
|
||||||
self.nvda.speak(f"Patch COMPOSITE {key[-1]} {val}")
|
self.nvda.speak(f"Patch COMPOSITE {key[-1]} {val}")
|
||||||
case [["PATCH", "COMPOSITE"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
case [["PATCH", "COMPOSITE"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
||||||
open_context_menu_for_buttonmenu(self, f"PATCH COMPOSITE||{key}")
|
util.open_context_menu_for_buttonmenu(self, f"PATCH COMPOSITE||{key}")
|
||||||
|
|
||||||
# Patch INSERT
|
# Patch INSERT
|
||||||
case [["INSERT", "CHECKBOX"], [in_num, channel]]:
|
case [["INSERT", "CHECKBOX"], [in_num, channel]]:
|
||||||
index = get_insert_checkbox_index(
|
index = util.get_insert_checkbox_index(
|
||||||
self.kind,
|
self.kind,
|
||||||
int(channel),
|
int(channel),
|
||||||
int(in_num[-1]),
|
int(in_num[-1]),
|
||||||
@ -601,17 +582,17 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
||||||
self.vm.patch.insert[index].on = val
|
self.vm.patch.insert[index].on = val
|
||||||
self.nvda.speak(
|
self.nvda.speak(
|
||||||
f"PATCH INSERT {in_num} {_patch_insert_channels[int(channel)]} set to {'on' if val else 'off'}"
|
f"PATCH INSERT {in_num} {util._patch_insert_channels[int(channel)]} set to {'on' if val else 'off'}"
|
||||||
)
|
)
|
||||||
case [["INSERT", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
|
case [["INSERT", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
|
||||||
if self.find_element_with_focus() is not None:
|
if self.find_element_with_focus() is not None:
|
||||||
index = get_insert_checkbox_index(
|
index = util.get_insert_checkbox_index(
|
||||||
self.kind,
|
self.kind,
|
||||||
int(channel),
|
int(channel),
|
||||||
int(in_num[-1]),
|
int(in_num[-1]),
|
||||||
)
|
)
|
||||||
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
||||||
channel = _patch_insert_channels[int(channel)]
|
channel = util._patch_insert_channels[int(channel)]
|
||||||
num = int(in_num[-1])
|
num = int(in_num[-1])
|
||||||
self.nvda.speak(f"Patch INSERT IN#{num} {channel} {'on' if val else 'off'}")
|
self.nvda.speak(f"Patch INSERT IN#{num} {channel} {'on' if val else 'off'}")
|
||||||
|
|
||||||
@ -700,7 +681,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 1
|
val += 1
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 1
|
val -= 1
|
||||||
self.vm.strip[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
||||||
case [
|
case [
|
||||||
["STRIP", index],
|
["STRIP", index],
|
||||||
@ -713,7 +694,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 3
|
val += 3
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 3
|
val -= 3
|
||||||
self.vm.strip[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
||||||
case [
|
case [
|
||||||
["STRIP", index],
|
["STRIP", index],
|
||||||
@ -726,7 +707,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 0.1
|
val += 0.1
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 0.1
|
val -= 0.1
|
||||||
self.vm.strip[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
self[f"STRIP {index}||SLIDER GAIN"].update(value=val)
|
||||||
|
|
||||||
# Bus Params
|
# Bus Params
|
||||||
@ -753,7 +734,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
f"{label} bus {param} {'on' if val else 'off'}",
|
f"{label} bus {param} {'on' if val else 'off'}",
|
||||||
)
|
)
|
||||||
case "MODE":
|
case "MODE":
|
||||||
bus_modes = get_bus_modes(self.vm)
|
bus_modes = util.get_bus_modes(self.vm)
|
||||||
next_index = bus_modes.index(val) + 1
|
next_index = bus_modes.index(val) + 1
|
||||||
if next_index == len(bus_modes):
|
if next_index == len(bus_modes):
|
||||||
next_index = 0
|
next_index = 0
|
||||||
@ -809,7 +790,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 1
|
val += 1
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 1
|
val -= 1
|
||||||
self.vm.bus[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
||||||
case [
|
case [
|
||||||
["BUS", index],
|
["BUS", index],
|
||||||
@ -822,7 +803,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 3
|
val += 3
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 3
|
val -= 3
|
||||||
self.vm.bus[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
||||||
case [
|
case [
|
||||||
["BUS", index],
|
["BUS", index],
|
||||||
@ -835,7 +816,7 @@ class NVDAVMWindow(psg.Window):
|
|||||||
val += 0.1
|
val += 0.1
|
||||||
case "LEFT" | "DOWN":
|
case "LEFT" | "DOWN":
|
||||||
val -= 0.1
|
val -= 0.1
|
||||||
self.vm.bus[int(index)].gain = check_bounds(val, (-60, 12))
|
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
|
||||||
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
||||||
|
|
||||||
# Unknown
|
# Unknown
|
||||||
|
Loading…
Reference in New Issue
Block a user