2023-09-04 05:11:45 +01:00
|
|
|
import json
|
2023-08-22 02:52:03 +01:00
|
|
|
import logging
|
2023-09-01 03:04:39 +01:00
|
|
|
from pathlib import Path
|
2023-08-22 02:52:03 +01:00
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
import PySimpleGUI as psg
|
|
|
|
|
2023-09-16 20:28:07 +01:00
|
|
|
from . import models, util
|
2023-08-22 16:11:24 +01:00
|
|
|
from .builder import Builder
|
2023-08-22 02:04:00 +01:00
|
|
|
from .nvda import Nvda
|
|
|
|
from .parser import Parser
|
2023-09-20 10:01:48 +01:00
|
|
|
from .popup import Popup
|
2023-08-22 02:04:00 +01:00
|
|
|
|
2023-08-22 02:52:03 +01:00
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
2023-08-25 02:19:01 +01:00
|
|
|
psg.theme("Dark Blue 3")
|
2023-08-24 18:02:53 +01:00
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
class NVDAVMWindow(psg.Window):
|
|
|
|
"""Represents the main window of the Voicemeeter NVDA application"""
|
2023-08-22 16:11:24 +01:00
|
|
|
|
2023-09-04 05:11:45 +01:00
|
|
|
SETTINGS = "settings.json"
|
2023-09-01 03:04:39 +01:00
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
def __init__(self, title, vm):
|
|
|
|
self.vm = vm
|
|
|
|
self.kind = self.vm.kind
|
2023-08-22 02:52:03 +01:00
|
|
|
self.logger = logger.getChild(type(self).__name__)
|
2023-09-02 04:23:15 +01:00
|
|
|
self.cache = {
|
2023-09-16 20:28:07 +01:00
|
|
|
"hw_ins": models._make_hardware_ins_cache(self.vm),
|
|
|
|
"hw_outs": models._make_hardware_outs_cache(self.vm),
|
|
|
|
"strip": models._make_param_cache(self.vm, "strip"),
|
|
|
|
"bus": models._make_param_cache(self.vm, "bus"),
|
|
|
|
"labels": models._make_label_cache(self.vm),
|
|
|
|
"asio": models._make_patch_asio_cache(self.vm),
|
|
|
|
"insert": models._make_patch_insert_cache(self.vm),
|
2023-09-02 04:23:15 +01:00
|
|
|
}
|
2023-08-22 02:04:00 +01:00
|
|
|
self.nvda = Nvda()
|
|
|
|
self.parser = Parser()
|
2023-09-20 10:01:48 +01:00
|
|
|
self.popup = Popup(self)
|
2023-08-26 00:11:05 +01:00
|
|
|
self.builder = Builder(self)
|
2023-08-22 16:11:24 +01:00
|
|
|
layout = self.builder.run()
|
2023-08-26 19:46:39 +01:00
|
|
|
super().__init__(title, layout, return_keyboard_events=True, finalize=True)
|
2023-08-28 12:11:34 +01:00
|
|
|
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
|
2023-09-06 00:03:12 +01:00
|
|
|
for i in range(self.kind.phys_in):
|
|
|
|
self[f"HARDWARE IN||{i + 1}"].Widget.config(**buttonmenu_opts)
|
2023-08-28 20:27:06 +01:00
|
|
|
for i in range(self.kind.phys_out):
|
|
|
|
self[f"HARDWARE OUT||A{i + 1}"].Widget.config(**buttonmenu_opts)
|
2023-09-06 16:20:04 +01:00
|
|
|
if self.kind.name == "basic":
|
|
|
|
self[f"HARDWARE OUT||A2"].Widget.config(**buttonmenu_opts)
|
2023-08-26 10:42:18 +01:00
|
|
|
if self.kind.name != "basic":
|
2023-08-28 12:11:34 +01:00
|
|
|
[self[f"PATCH COMPOSITE||PC{i + 1}"].Widget.config(**buttonmenu_opts) for i in range(self.kind.phys_out)]
|
2023-09-15 10:55:22 +01:00
|
|
|
slider_opts = {"takefocus": 1, "highlightthickness": 1}
|
|
|
|
for i in range(self.kind.num_strip):
|
2023-09-17 14:49:42 +01:00
|
|
|
for param in util.get_slider_params(i, self.vm):
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].Widget.config(**slider_opts)
|
2023-09-15 10:55:22 +01:00
|
|
|
self[f"STRIP {i}||SLIDER GAIN"].Widget.config(**slider_opts)
|
2023-09-16 23:13:56 +01:00
|
|
|
if self.kind.name != "basic":
|
|
|
|
self[f"STRIP {i}||SLIDER LIMIT"].Widget.config(**slider_opts)
|
2023-09-15 10:55:22 +01:00
|
|
|
for i in range(self.kind.num_bus):
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].Widget.config(**slider_opts)
|
2023-09-11 07:51:16 +01:00
|
|
|
|
2023-08-22 02:52:03 +01:00
|
|
|
self.register_events()
|
2023-09-14 13:46:26 +01:00
|
|
|
self["tabgroup"].set_focus()
|
2023-08-22 02:04:00 +01:00
|
|
|
|
|
|
|
def __enter__(self):
|
2023-09-05 05:30:46 +01:00
|
|
|
settings_path = Path.cwd() / self.SETTINGS
|
|
|
|
if settings_path.exists():
|
2023-09-01 03:04:39 +01:00
|
|
|
try:
|
2023-09-05 05:30:46 +01:00
|
|
|
with open(settings_path, "r") as f:
|
2023-09-04 05:11:45 +01:00
|
|
|
data = json.load(f)
|
2023-09-05 05:30:46 +01:00
|
|
|
defaultconfig = Path(data["default_config"])
|
|
|
|
if defaultconfig.exists():
|
|
|
|
self.vm.set("command.load", str(defaultconfig))
|
|
|
|
self.logger.debug(f"config {defaultconfig} loaded")
|
2023-09-01 10:43:37 +01:00
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-05 05:30:46 +01:00
|
|
|
f"config {defaultconfig.stem} has been loaded",
|
2023-09-01 10:43:37 +01:00
|
|
|
)
|
2023-09-04 05:11:45 +01:00
|
|
|
except json.JSONDecodeError:
|
|
|
|
self.logger.debug("no data in settings.json. silently continuing...")
|
2023-09-01 03:04:39 +01:00
|
|
|
|
2023-09-05 05:30:46 +01:00
|
|
|
self.vm.init_thread()
|
|
|
|
self.vm.observer.add(self.on_pdirty)
|
|
|
|
self.TKroot.after(1000, self.enable_parameter_updates)
|
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
return self
|
|
|
|
|
2023-09-05 05:30:46 +01:00
|
|
|
def enable_parameter_updates(self):
|
|
|
|
self.vm.event.pdirty = True
|
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
def __exit__(self, exc_type, exc_value, traceback):
|
2023-09-05 05:30:46 +01:00
|
|
|
self.vm.end_thread()
|
2023-08-22 02:04:00 +01:00
|
|
|
self.close()
|
|
|
|
|
2023-09-05 05:30:46 +01:00
|
|
|
def on_pdirty(self):
|
|
|
|
self.cache = {
|
2023-09-16 20:28:07 +01:00
|
|
|
"hw_ins": models._make_hardware_ins_cache(self.vm),
|
|
|
|
"hw_outs": models._make_hardware_outs_cache(self.vm),
|
|
|
|
"strip": models._make_param_cache(self.vm, "strip"),
|
|
|
|
"bus": models._make_param_cache(self.vm, "bus"),
|
|
|
|
"labels": models._make_label_cache(self.vm),
|
|
|
|
"asio": models._make_patch_asio_cache(self.vm),
|
|
|
|
"insert": models._make_patch_insert_cache(self.vm),
|
2023-09-05 05:30:46 +01:00
|
|
|
}
|
|
|
|
for key, value in self.cache["labels"].items():
|
|
|
|
self[key].update(value=value)
|
2023-09-15 10:55:22 +01:00
|
|
|
self[f"{key}||SLIDER"].update(value=value)
|
|
|
|
for i in range(self.kind.num_strip):
|
|
|
|
self[f"STRIP {i}||SLIDER GAIN"].update(value=self.vm.strip[i].gain)
|
2023-09-17 14:49:42 +01:00
|
|
|
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):
|
|
|
|
if param in ("AUDIBILITY", "BASS", "MID", "TREBLE"):
|
|
|
|
val = getattr(self.vm.strip[i], param.lower())
|
|
|
|
else:
|
|
|
|
target = getattr(self.vm.strip[i], param.lower())
|
|
|
|
val = target.knob
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].update(value=val)
|
2023-09-15 10:55:22 +01:00
|
|
|
for i in range(self.kind.num_bus):
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].update(value=self.vm.bus[i].gain)
|
2023-09-06 00:03:12 +01:00
|
|
|
if self.kind.name != "basic":
|
|
|
|
for key, value in self.cache["asio"].items():
|
|
|
|
identifier, i = key.split("||")
|
2023-09-16 20:28:07 +01:00
|
|
|
partial = util.get_channel_identifier_list(self.vm)[int(i)]
|
2023-09-06 00:03:12 +01:00
|
|
|
self[f"{identifier}||{partial}"].update(value=value)
|
|
|
|
for key, value in self.cache["insert"].items():
|
|
|
|
identifier, i = key.split("||")
|
2023-09-16 20:28:07 +01:00
|
|
|
partial = util.get_channel_identifier_list(self.vm)[int(i)]
|
2023-09-06 00:03:12 +01:00
|
|
|
self[f"{identifier}||{partial}"].update(value=value)
|
2023-09-05 05:30:46 +01:00
|
|
|
|
2023-08-22 02:52:03 +01:00
|
|
|
def register_events(self):
|
2023-08-25 20:23:21 +01:00
|
|
|
"""Registers events for widgets"""
|
|
|
|
|
2023-08-25 22:53:48 +01:00
|
|
|
# TABS
|
2023-09-14 13:46:26 +01:00
|
|
|
self["tabgroup"].bind("<FocusIn>", "||FOCUS IN")
|
2023-09-16 20:28:07 +01:00
|
|
|
for tabname in util.get_tabs_labels()[1:]:
|
2023-09-14 13:46:26 +01:00
|
|
|
self[f"tabgroup||{tabname}"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"tabgroup||{tabname}"].bind("<Shift-KeyPress-Tab>", "||KEY SHIFT TAB")
|
2023-08-28 20:27:06 +01:00
|
|
|
self.bind("<Control-KeyPress-Tab>", "CTRL-TAB")
|
|
|
|
self.bind("<Control-Shift-KeyPress-Tab>", "CTRL-SHIFT-TAB")
|
2023-09-20 10:01:48 +01:00
|
|
|
|
|
|
|
# NAV
|
2023-09-11 07:51:16 +01:00
|
|
|
self.bind("<Control-a>", "CTRL-A")
|
2023-09-18 00:07:35 +01:00
|
|
|
for i in range(1, 10):
|
|
|
|
self.bind(f"<Control-Key-{i}>", f"CTRL-{i}")
|
2023-09-19 22:22:44 +01:00
|
|
|
for i in range(1, 10):
|
|
|
|
self.bind(f"<Alt-Key-{i}>", f"ALT-{i}")
|
|
|
|
self.bind("<Control-o>", "CTRL-O")
|
|
|
|
self.bind("<Control-s>", "CTRL-S")
|
|
|
|
self.bind("<Control-m>", "CTRL-M")
|
|
|
|
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")
|
|
|
|
self.bind("<Control-l>", "LIMIT MODE")
|
2023-08-25 22:53:48 +01:00
|
|
|
|
2023-09-20 10:40:09 +01:00
|
|
|
self.bind("<Alt-Left>", "LEFT")
|
|
|
|
self.bind("<Alt-Right>", "RIGHT")
|
|
|
|
self.bind("<Alt-Shift-KeyPress-Left>", "SHIFT-LEFT")
|
|
|
|
self.bind("<Alt-Shift-KeyPress-Right>", "SHIFT-RIGHT")
|
|
|
|
self.bind("<Alt-Control-KeyPress-Left>", "CTRL-LEFT")
|
|
|
|
self.bind("<Alt-Control-KeyPress-Right>", "CTRL-RIGHT")
|
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Hardware In
|
|
|
|
for i in range(self.vm.kind.phys_in):
|
|
|
|
self[f"HARDWARE IN||{i + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"HARDWARE IN||{i + 1}"].bind("<space>", "||KEY SPACE", propagate=False)
|
|
|
|
self[f"HARDWARE IN||{i + 1}"].bind("<Return>", "||KEY ENTER", propagate=False)
|
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
# Hardware Out
|
2023-08-25 20:41:48 +01:00
|
|
|
for i in range(self.vm.kind.phys_out):
|
|
|
|
self[f"HARDWARE OUT||A{i + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-28 20:27:06 +01:00
|
|
|
self[f"HARDWARE OUT||A{i + 1}"].bind("<space>", "||KEY SPACE", propagate=False)
|
|
|
|
self[f"HARDWARE OUT||A{i + 1}"].bind("<Return>", "||KEY ENTER", propagate=False)
|
2023-09-06 16:20:04 +01:00
|
|
|
if self.vm.kind.name == "basic":
|
|
|
|
self[f"HARDWARE OUT||A2"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"HARDWARE OUT||A2"].bind("<space>", "||KEY SPACE", propagate=False)
|
|
|
|
self[f"HARDWARE OUT||A2"].bind("<Return>", "||KEY ENTER", propagate=False)
|
2023-08-25 18:29:43 +01:00
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
# Patch ASIO
|
2023-08-23 02:31:15 +01:00
|
|
|
if self.kind.name != "basic":
|
2023-08-25 20:41:48 +01:00
|
|
|
for i in range(self.kind.phys_out):
|
|
|
|
self[f"ASIO CHECKBOX||IN{i + 1} 0"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"ASIO CHECKBOX||IN{i + 1} 1"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-25 18:29:43 +01:00
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
# Patch Composite
|
2023-08-26 10:42:18 +01:00
|
|
|
if self.kind.name != "basic":
|
|
|
|
for i in range(self.vm.kind.phys_out):
|
|
|
|
self[f"PATCH COMPOSITE||PC{i + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-28 20:27:06 +01:00
|
|
|
self[f"PATCH COMPOSITE||PC{i + 1}"].bind("<space>", "||KEY SPACE", propagate=False)
|
|
|
|
self[f"PATCH COMPOSITE||PC{i + 1}"].bind("<Return>", "||KEY ENTER", propagate=False)
|
2023-08-25 18:29:43 +01:00
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
# Patch Insert
|
2023-08-23 02:31:15 +01:00
|
|
|
if self.kind.name != "basic":
|
2023-08-25 20:41:48 +01:00
|
|
|
for i in range(self.kind.num_strip):
|
2023-08-26 17:29:24 +01:00
|
|
|
if i < self.kind.phys_in:
|
2023-08-25 20:41:48 +01:00
|
|
|
self[f"INSERT CHECKBOX||IN{i + 1} 0"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"INSERT CHECKBOX||IN{i + 1} 1"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-23 02:31:15 +01:00
|
|
|
else:
|
2023-08-25 20:41:48 +01:00
|
|
|
[self[f"INSERT CHECKBOX||IN{i + 1} {j}"].bind("<FocusIn>", "||FOCUS IN") for j in range(8)]
|
2023-08-22 02:52:03 +01:00
|
|
|
|
2023-09-11 07:51:16 +01:00
|
|
|
# Advanced Settings
|
2023-09-13 14:12:48 +01:00
|
|
|
self["ADVANCED SETTINGS"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self["ADVANCED SETTINGS"].bind("<Return>", "||KEY ENTER")
|
2023-09-11 07:51:16 +01:00
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Strip Params
|
2023-08-25 22:25:30 +01:00
|
|
|
for i in range(self.kind.num_strip):
|
|
|
|
for j in range(self.kind.phys_out):
|
|
|
|
self[f"STRIP {i}||A{j + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-28 20:27:06 +01:00
|
|
|
self[f"STRIP {i}||A{j + 1}"].bind("<Return>", "||KEY ENTER")
|
2023-08-25 22:25:30 +01:00
|
|
|
for j in range(self.kind.virt_out):
|
|
|
|
self[f"STRIP {i}||B{j + 1}"].bind("<FocusIn>", "||FOCUS IN")
|
2023-08-28 20:27:06 +01:00
|
|
|
self[f"STRIP {i}||B{j + 1}"].bind("<Return>", "||KEY ENTER")
|
2023-09-06 00:03:12 +01:00
|
|
|
if i < self.kind.phys_in:
|
|
|
|
for param in ("MONO", "SOLO", "MUTE"):
|
|
|
|
self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
|
|
|
|
else:
|
|
|
|
for param in ("MONO", "SOLO", "MUTE"):
|
|
|
|
self[f"STRIP {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"STRIP {i}||{param}"].bind("<Return>", "||KEY ENTER")
|
|
|
|
|
2023-09-15 10:55:22 +01:00
|
|
|
# Strip Sliders
|
|
|
|
for i in range(self.kind.num_strip):
|
2023-09-17 10:18:22 +01:00
|
|
|
for param in util.get_slider_params(i, self.vm) + ("GAIN", "LIMIT"):
|
2023-09-17 09:30:38 +01:00
|
|
|
if self.kind.name == "basic" and param == "LIMIT":
|
|
|
|
continue
|
|
|
|
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")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Right>", "||KEY RIGHT")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Shift-KeyPress-Left>", "||KEY SHIFT LEFT")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Shift-KeyPress-Right>", "||KEY SHIFT RIGHT")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Control-KeyPress-Left>", "||KEY CTRL LEFT")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Control-KeyPress-Right>", "||KEY CTRL RIGHT")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Up>", "||KEY UP")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Down>", "||KEY DOWN")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Shift-KeyPress-Up>", "||KEY SHIFT UP")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Shift-KeyPress-Down>", "||KEY SHIFT DOWN")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Control-KeyPress-Up>", "||KEY CTRL UP")
|
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Control-KeyPress-Down>", "||KEY CTRL DOWN")
|
2023-09-18 09:12:12 +01:00
|
|
|
self[f"STRIP {i}||SLIDER {param}"].bind("<Control-Shift-KeyPress-R>", "||KEY CTRL SHIFT R")
|
2023-09-15 10:55:22 +01:00
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Bus Params
|
2023-09-06 19:18:14 +01:00
|
|
|
params = ["MONO", "EQ", "MUTE", "MODE"]
|
|
|
|
if self.vm.kind.name == "basic":
|
|
|
|
params.remove("EQ")
|
2023-08-28 20:27:06 +01:00
|
|
|
for i in range(self.kind.num_bus):
|
2023-09-06 19:18:14 +01:00
|
|
|
for param in params:
|
2023-09-06 00:03:12 +01:00
|
|
|
self[f"BUS {i}||{param}"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"BUS {i}||{param}"].bind("<Return>", "||KEY ENTER")
|
2023-08-26 20:22:46 +01:00
|
|
|
|
2023-09-15 10:55:22 +01:00
|
|
|
# Bus Sliders
|
|
|
|
for i in range(self.kind.num_bus):
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<FocusIn>", "||FOCUS IN")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<FocusOut>", "||FOCUS OUT")
|
2023-09-15 11:35:27 +01:00
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Left>", "||KEY LEFT")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Right>", "||KEY RIGHT")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Shift-KeyPress-Left>", "||KEY SHIFT LEFT")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Shift-KeyPress-Right>", "||KEY SHIFT RIGHT")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-KeyPress-Left>", "||KEY CTRL LEFT")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-KeyPress-Right>", "||KEY CTRL RIGHT")
|
2023-09-15 12:35:10 +01:00
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Up>", "||KEY UP")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Down>", "||KEY DOWN")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Shift-KeyPress-Up>", "||KEY SHIFT UP")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Shift-KeyPress-Down>", "||KEY SHIFT DOWN")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-KeyPress-Up>", "||KEY CTRL UP")
|
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-KeyPress-Down>", "||KEY CTRL DOWN")
|
2023-09-18 09:12:12 +01:00
|
|
|
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-Shift-KeyPress-R>", "||KEY CTRL SHIFT R")
|
2023-09-15 10:55:22 +01:00
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
def run(self):
|
2023-08-22 05:16:43 +01:00
|
|
|
"""
|
|
|
|
Parses the event string and matches it to events
|
|
|
|
|
|
|
|
Main thread will shutdown once a close or exit event occurs
|
|
|
|
"""
|
2023-09-19 22:22:44 +01:00
|
|
|
mode = None
|
2023-08-25 20:23:21 +01:00
|
|
|
|
2023-08-22 02:04:00 +01:00
|
|
|
while True:
|
|
|
|
event, values = self.read()
|
2023-08-26 09:39:51 +01:00
|
|
|
self.logger.debug(f"event::{event}")
|
|
|
|
self.logger.debug(f"values::{values}")
|
2023-08-22 02:04:00 +01:00
|
|
|
if event in (psg.WIN_CLOSED, "Exit"):
|
|
|
|
break
|
2023-09-20 10:01:48 +01:00
|
|
|
elif event in ("GAIN MODE", "COMP MODE", "GATE MODE", "DENOISER MODE", "LIMIT MODE"):
|
2023-09-19 22:22:44 +01:00
|
|
|
mode = event
|
2023-09-20 10:01:48 +01:00
|
|
|
self.nvda.speak(f"{mode} enabled")
|
2023-09-19 22:22:44 +01:00
|
|
|
elif event == "Escape:27":
|
|
|
|
if mode:
|
2023-09-20 10:01:48 +01:00
|
|
|
self.nvda.speak(f"{mode.split()[0]} mode disabled")
|
2023-09-20 10:40:09 +01:00
|
|
|
mode = None
|
2023-09-19 22:22:44 +01:00
|
|
|
|
|
|
|
if mode:
|
2023-09-20 10:40:09 +01:00
|
|
|
if event in ("LEFT", "RIGHT", "SHIFT-LEFT", "SHIFT-RIGHT", "CTRL-LEFT", "CTRL-RIGHT"):
|
|
|
|
self.write_event_value(f"SLIDER-MODE-{event}", mode.split()[0])
|
|
|
|
continue
|
2023-08-25 22:33:28 +01:00
|
|
|
|
2023-08-23 02:04:18 +01:00
|
|
|
match parsed_cmd := self.parser.match.parseString(event):
|
2023-08-29 02:58:13 +01:00
|
|
|
# Focus tabgroup
|
2023-08-28 12:11:34 +01:00
|
|
|
case ["CTRL-TAB"] | ["CTRL-SHIFT-TAB"]:
|
2023-09-14 13:46:26 +01:00
|
|
|
self["tabgroup"].set_focus()
|
|
|
|
self.nvda.speak(f"{values['tabgroup']}")
|
2023-08-28 12:11:34 +01:00
|
|
|
|
2023-09-18 00:07:35 +01:00
|
|
|
# Quick Navigation
|
|
|
|
case ["CTRL-1" | "CTRL-2" | "CTRL-3" | "CTRL-4" | "CTRL-5" | "CTRL-6" | "CTRL-7" | "CTRL-8" as bind]:
|
|
|
|
key, index = bind.split("-")
|
|
|
|
match values["tabgroup"]:
|
|
|
|
case "tab||Physical Strip":
|
2023-09-18 23:07:09 +01:00
|
|
|
if int(index) > self.kind.phys_in:
|
|
|
|
continue
|
2023-09-18 00:07:35 +01:00
|
|
|
self[f"STRIP {int(index) - 1}||A1"].set_focus()
|
|
|
|
if (
|
|
|
|
self.find_element_with_focus() is None
|
|
|
|
or self.find_element_with_focus().Key != f"STRIP {int(index) - 1}||A1"
|
|
|
|
):
|
|
|
|
self[f"STRIP {int(index) - 1}||SLIDER GAIN"].set_focus()
|
|
|
|
case "tab||Virtual Strip":
|
|
|
|
index = int(index) + self.kind.phys_in
|
|
|
|
if index > self.kind.num_strip:
|
|
|
|
continue
|
|
|
|
self[f"STRIP {index - 1}||A1"].set_focus()
|
|
|
|
if (
|
|
|
|
self.find_element_with_focus() is None
|
|
|
|
or self.find_element_with_focus().Key != f"STRIP {int(index) - 1}||A1"
|
|
|
|
):
|
|
|
|
self[f"STRIP {int(index) - 1}||SLIDER GAIN"].set_focus()
|
|
|
|
case "tab||Buses":
|
2023-09-18 23:07:09 +01:00
|
|
|
if int(index) > self.kind.num_bus:
|
|
|
|
continue
|
2023-09-18 00:07:35 +01:00
|
|
|
self[f"BUS {int(index) - 1}||MONO"].set_focus()
|
|
|
|
if (
|
|
|
|
self.find_element_with_focus() is None
|
|
|
|
or self.find_element_with_focus().Key != f"BUS {int(index) - 1}||MONO"
|
|
|
|
):
|
|
|
|
self[f"BUS {int(index) - 1}||SLIDER GAIN"].set_focus()
|
2023-09-19 22:22:44 +01:00
|
|
|
case ["ALT-1" | "ALT-2" | "ALT-3" | "ALT-4" | "ALT-5" | "ALT-6" | "ALT-7" | "ALT-8" as bind]:
|
|
|
|
if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"):
|
|
|
|
continue
|
|
|
|
key, index = bind.split("-")
|
|
|
|
if int(index) > self.kind.phys_out + self.kind.virt_out:
|
|
|
|
continue
|
|
|
|
if focus := self.find_element_with_focus():
|
|
|
|
identifier, param = focus.Key.split("||")
|
|
|
|
if int(index) <= self.kind.phys_out:
|
|
|
|
self.write_event_value(f"{identifier}||A{int(index)}", None)
|
|
|
|
else:
|
|
|
|
self.write_event_value(f"{identifier}||B{int(index) - self.kind.phys_out}", None)
|
|
|
|
case ["CTRL-O"]:
|
|
|
|
if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"):
|
|
|
|
continue
|
|
|
|
if focus := self.find_element_with_focus():
|
|
|
|
identifier, param = focus.Key.split("||")
|
|
|
|
self.write_event_value(f"{identifier}||MONO", None)
|
|
|
|
case ["CTRL-S"]:
|
|
|
|
if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip"):
|
|
|
|
continue
|
|
|
|
if focus := self.find_element_with_focus():
|
|
|
|
identifier, param = focus.Key.split("||")
|
|
|
|
self.write_event_value(f"{identifier}||SOLO", None)
|
|
|
|
case ["CTRL-M"]:
|
|
|
|
if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"):
|
|
|
|
continue
|
|
|
|
if focus := self.find_element_with_focus():
|
|
|
|
identifier, param = focus.Key.split("||")
|
|
|
|
self.write_event_value(f"{identifier}||MUTE", None)
|
2023-09-20 16:29:42 +01:00
|
|
|
case [
|
|
|
|
"SLIDER-MODE-LEFT"
|
|
|
|
| "SLIDER-MODE-RIGHT"
|
|
|
|
| "SLIDER-MODE-SHIFT-LEFT"
|
|
|
|
| "SLIDER-MODE-SHIFT-RIGHT"
|
|
|
|
| "SLIDER-MODE-CTRL-LEFT"
|
|
|
|
| "SLIDER-MODE-CTRL-RIGHT" as op
|
|
|
|
]:
|
|
|
|
op = op.removeprefix("SLIDER-MODE-").split("-")
|
2023-09-20 10:40:09 +01:00
|
|
|
if values["tabgroup"] not in ("tab||Physical Strip", "tab||Virtual Strip", "tab||Buses"):
|
|
|
|
continue
|
|
|
|
param = values[event]
|
|
|
|
if focus := self.find_element_with_focus():
|
|
|
|
identifier, partial = focus.Key.split("||")
|
|
|
|
if "SLIDER" not in partial:
|
2023-09-20 16:29:42 +01:00
|
|
|
self.write_event_value(f"{identifier}||SLIDER {param}||KEY {' '.join(op)}", None)
|
2023-09-18 00:07:35 +01:00
|
|
|
|
2023-09-02 04:23:15 +01:00
|
|
|
# Rename popups
|
|
|
|
case ["F2:113"]:
|
2023-09-20 10:01:48 +01:00
|
|
|
tab = values["tabgroup"].split("||")[1]
|
2023-09-02 04:23:15 +01:00
|
|
|
if tab in ("Physical Strip", "Virtual Strip", "Buses"):
|
2023-09-20 10:01:48 +01:00
|
|
|
data = self.popup.rename("Label", title=f"Rename {tab}", tab=tab)
|
2023-09-05 05:30:46 +01:00
|
|
|
if not data: # cancel was pressed
|
2023-09-02 05:00:38 +01:00
|
|
|
continue
|
|
|
|
index = int(data["Index"]) - 1
|
|
|
|
match tab:
|
2023-09-05 05:30:46 +01:00
|
|
|
case "Physical Strip":
|
2023-09-16 20:28:07 +01:00
|
|
|
label = data.get("Edit", f"Hardware Input {index + 1}")
|
2023-09-05 05:30:46 +01:00
|
|
|
self.vm.strip[index].label = label
|
|
|
|
self[f"STRIP {index}||LABEL"].update(value=label)
|
|
|
|
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
|
|
|
case "Virtual Strip":
|
2023-09-10 14:23:34 +01:00
|
|
|
index += self.kind.phys_in
|
2023-09-16 20:28:07 +01:00
|
|
|
label = data.get("Edit", f"Virtual Input {index - self.kind.phys_in + 1}")
|
2023-09-02 05:00:38 +01:00
|
|
|
self.vm.strip[index].label = label
|
|
|
|
self[f"STRIP {index}||LABEL"].update(value=label)
|
2023-09-05 05:30:46 +01:00
|
|
|
self.cache["labels"][f"STRIP {index}||LABEL"] = label
|
2023-09-02 05:00:38 +01:00
|
|
|
case "Buses":
|
2023-09-05 05:30:46 +01:00
|
|
|
if index < self.kind.phys_out:
|
2023-09-16 20:28:07 +01:00
|
|
|
label = data.get("Edit", f"Physical Bus {index + 1}")
|
2023-09-05 05:30:46 +01:00
|
|
|
else:
|
2023-09-16 20:28:07 +01:00
|
|
|
label = data.get("Edit", f"Virtual Bus {index - self.kind.phys_out + 1}")
|
2023-09-02 05:00:38 +01:00
|
|
|
self.vm.bus[index].label = label
|
|
|
|
self[f"BUS {index}||LABEL"].update(value=label)
|
2023-09-05 05:30:46 +01:00
|
|
|
self.cache["labels"][f"BUS {index}||LABEL"] = label
|
2023-09-02 04:23:15 +01:00
|
|
|
|
2023-08-26 19:46:39 +01:00
|
|
|
# Menus
|
|
|
|
case [["Restart", "Audio", "Engine"], ["MENU"]]:
|
|
|
|
self.perform_long_operation(self.vm.command.restart, "ENGINE RESTART||END")
|
|
|
|
case [["ENGINE", "RESTART"], ["END"]]:
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-01 03:04:39 +01:00
|
|
|
"Audio Engine restarted",
|
2023-08-26 19:46:39 +01:00
|
|
|
)
|
2023-09-01 03:04:39 +01:00
|
|
|
case [["Save", "Settings"], ["MENU"]]:
|
2023-09-01 10:43:37 +01:00
|
|
|
initial_folder = Path.home() / "Documents" / "Voicemeeter"
|
2023-09-20 10:01:48 +01:00
|
|
|
if filepath := self.popup.save_as(
|
2023-09-01 23:20:36 +01:00
|
|
|
"Open the file browser", title="Save As", initial_folder=initial_folder
|
|
|
|
):
|
2023-09-01 10:43:37 +01:00
|
|
|
self.vm.set("command.save", str(filepath))
|
|
|
|
self.logger.debug(f"saving config file to {filepath}")
|
2023-09-01 03:04:39 +01:00
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-01 10:43:37 +01:00
|
|
|
f"config file {filepath.stem} has been saved",
|
2023-09-01 03:04:39 +01:00
|
|
|
)
|
|
|
|
case [["Load", "Settings"], ["MENU"]]:
|
2023-09-01 10:43:37 +01:00
|
|
|
initial_folder = Path.home() / "Documents" / "Voicemeeter"
|
2023-09-01 23:20:36 +01:00
|
|
|
if filepath := psg.popup_get_file(
|
|
|
|
"Filename",
|
|
|
|
title="Load Settings",
|
|
|
|
initial_folder=initial_folder,
|
|
|
|
no_window=True,
|
|
|
|
file_types=(("XML", ".xml"),),
|
2023-09-01 10:43:37 +01:00
|
|
|
):
|
2023-09-01 23:20:36 +01:00
|
|
|
filepath = Path(filepath)
|
2023-09-01 10:43:37 +01:00
|
|
|
self.vm.set("command.load", str(filepath))
|
|
|
|
self.logger.debug(f"loading config file from {filepath}")
|
2023-09-16 10:45:56 +01:00
|
|
|
for i in (25, 50): # for the benefit of the sliders
|
|
|
|
self.TKroot.after(i, self.on_pdirty)
|
2023-09-01 03:04:39 +01:00
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-01 10:43:37 +01:00
|
|
|
f"config file {filepath.stem} has been loaded",
|
2023-09-01 03:04:39 +01:00
|
|
|
)
|
|
|
|
case [["Load", "Settings", "on", "Startup"], ["MENU"]]:
|
2023-09-01 10:43:37 +01:00
|
|
|
initial_folder = Path.home() / "Documents" / "Voicemeeter"
|
2023-09-01 23:20:36 +01:00
|
|
|
if filepath := psg.popup_get_file(
|
|
|
|
"Filename",
|
|
|
|
title="Load Settings",
|
|
|
|
initial_folder=initial_folder,
|
|
|
|
no_window=True,
|
|
|
|
file_types=(("XML", ".xml"),),
|
2023-09-01 10:43:37 +01:00
|
|
|
):
|
2023-09-01 23:20:36 +01:00
|
|
|
filepath = Path(filepath)
|
2023-09-04 05:11:45 +01:00
|
|
|
with open(self.SETTINGS, "w") as f:
|
|
|
|
json.dump({"default_config": str(filepath)}, f)
|
2023-09-01 03:04:39 +01:00
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-01 23:20:36 +01:00
|
|
|
f"config {filepath.stem} set as default on startup",
|
2023-09-01 03:04:39 +01:00
|
|
|
)
|
|
|
|
else:
|
2023-09-04 05:11:45 +01:00
|
|
|
with open(self.SETTINGS, "wb") as f:
|
2023-09-01 03:04:39 +01:00
|
|
|
f.truncate()
|
2023-09-14 13:46:26 +01:00
|
|
|
self.logger.debug("settings.json was truncated")
|
2023-08-26 19:46:39 +01:00
|
|
|
|
2023-08-25 22:53:48 +01:00
|
|
|
# Tabs
|
2023-09-14 13:46:26 +01:00
|
|
|
case ["tabgroup"] | [["tabgroup"], ["FOCUS", "IN"]]:
|
|
|
|
if self.find_element_with_focus() is None:
|
|
|
|
self.nvda.speak(f"{values['tabgroup']}")
|
|
|
|
case [["tabgroup"], tabname] | [["tabgroup"], tabname, ["FOCUS", "IN"]]:
|
|
|
|
if self.find_element_with_focus() is None:
|
|
|
|
name = " ".join(tabname)
|
|
|
|
self.nvda.speak(f"{values[f'tabgroup||{name}']}")
|
|
|
|
case [["tabgroup"], _, ["KEY", "SHIFT", "TAB"]]:
|
|
|
|
self.nvda.speak(values["tabgroup"])
|
2023-08-25 22:53:48 +01:00
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Hardware In
|
|
|
|
case [["HARDWARE", "IN"], [key]]:
|
|
|
|
selection = values[f"HARDWARE IN||{key}"]
|
|
|
|
index = int(key) - 1
|
|
|
|
match selection.split(":"):
|
|
|
|
case [device_name]:
|
|
|
|
setattr(self.vm.strip[index].device, "wdm", "")
|
|
|
|
self.TKroot.after(200, self.nvda.speak, f"HARDWARE IN {key} device selection removed")
|
|
|
|
case [driver, device_name]:
|
2023-09-13 10:59:41 +01:00
|
|
|
setattr(self.vm.strip[index].device, driver, device_name.lstrip())
|
2023-09-06 00:03:12 +01:00
|
|
|
phonetic = {"mme": "em em e"}
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
|
|
|
f"HARDWARE IN {key} set {phonetic.get(driver, driver)} {device_name}",
|
|
|
|
)
|
|
|
|
case [["HARDWARE", "IN"], [key], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
self.nvda.speak(f"HARDWARE INPUT {key} {self.cache['hw_ins'][f'HARDWARE IN||{key}']}")
|
2023-09-06 00:03:12 +01:00
|
|
|
case [["HARDWARE", "IN"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
2023-09-16 20:28:07 +01:00
|
|
|
util.open_context_menu_for_buttonmenu(self, f"HARDWARE IN||{key}")
|
2023-09-06 00:03:12 +01:00
|
|
|
|
2023-08-25 20:23:21 +01:00
|
|
|
# Hardware out
|
2023-08-22 02:52:03 +01:00
|
|
|
case [["HARDWARE", "OUT"], [key]]:
|
|
|
|
selection = values[f"HARDWARE OUT||{key}"]
|
2023-08-23 02:04:18 +01:00
|
|
|
index = int(key[1]) - 1
|
2023-08-22 05:37:06 +01:00
|
|
|
match selection.split(":"):
|
|
|
|
case [device_name]:
|
2023-08-23 02:04:18 +01:00
|
|
|
setattr(self.vm.bus[index].device, "wdm", "")
|
2023-08-24 16:07:28 +01:00
|
|
|
self.TKroot.after(200, self.nvda.speak, f"HARDWARE OUT {key} device selection removed")
|
2023-08-22 05:37:06 +01:00
|
|
|
case [driver, device_name]:
|
2023-09-13 10:56:09 +01:00
|
|
|
setattr(self.vm.bus[index].device, driver, device_name.lstrip())
|
2023-08-24 16:07:28 +01:00
|
|
|
phonetic = {"mme": "em em e"}
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
|
|
|
f"HARDWARE OUT {key} set {phonetic.get(driver, driver)} {device_name}",
|
|
|
|
)
|
2023-08-22 02:52:03 +01:00
|
|
|
case [["HARDWARE", "OUT"], [key], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
self.nvda.speak(f"HARDWARE OUT {key} {self.cache['hw_outs'][f'HARDWARE OUT||{key}']}")
|
2023-08-28 20:27:06 +01:00
|
|
|
case [["HARDWARE", "OUT"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
2023-09-16 20:28:07 +01:00
|
|
|
util.open_context_menu_for_buttonmenu(self, f"HARDWARE OUT||{key}")
|
2023-08-25 20:23:21 +01:00
|
|
|
|
|
|
|
# Patch ASIO
|
2023-08-22 20:41:44 +01:00
|
|
|
case [["ASIO", "CHECKBOX"], [in_num, channel]]:
|
2023-09-16 20:28:07 +01:00
|
|
|
index = util.get_asio_checkbox_index(int(channel), int(in_num[-1]))
|
2023-08-22 20:41:44 +01:00
|
|
|
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
|
2023-08-22 05:16:43 +01:00
|
|
|
self.vm.patch.asio[index].set(val)
|
2023-08-22 20:41:44 +01:00
|
|
|
channel = ("left", "right")[int(channel)]
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(str(val))
|
2023-08-22 20:41:44 +01:00
|
|
|
case [["ASIO", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
|
|
|
|
channel = ("left", "right")[int(channel)]
|
|
|
|
num = int(in_num[-1])
|
|
|
|
self.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {val}")
|
2023-08-25 20:23:21 +01:00
|
|
|
|
|
|
|
# Patch COMPOSITE
|
|
|
|
case [["PATCH", "COMPOSITE"], [key]]:
|
|
|
|
val = values[f"PATCH COMPOSITE||{key}"]
|
|
|
|
index = int(key[-1]) - 1
|
2023-09-16 20:28:07 +01:00
|
|
|
self.vm.patch.composite[index].set(util.get_patch_composite_list(self.kind).index(val) + 1)
|
2023-08-25 20:23:21 +01:00
|
|
|
self.TKroot.after(200, self.nvda.speak, f"PATCH COMPOSITE {key[-1]} set {val}")
|
|
|
|
case [["PATCH", "COMPOSITE"], [key], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
if values[f"PATCH COMPOSITE||{key}"]:
|
|
|
|
val = values[f"PATCH COMPOSITE||{key}"]
|
|
|
|
else:
|
|
|
|
index = int(key[-1]) - 1
|
2023-09-16 20:28:07 +01:00
|
|
|
val = util.get_patch_composite_list(self.kind)[self.vm.patch.composite[index].get() - 1]
|
2023-09-14 13:46:26 +01:00
|
|
|
self.nvda.speak(f"Patch COMPOSITE {key[-1]} {val}")
|
2023-08-28 20:27:06 +01:00
|
|
|
case [["PATCH", "COMPOSITE"], [key], ["KEY", "SPACE" | "ENTER"]]:
|
2023-09-16 20:28:07 +01:00
|
|
|
util.open_context_menu_for_buttonmenu(self, f"PATCH COMPOSITE||{key}")
|
2023-08-25 20:23:21 +01:00
|
|
|
|
|
|
|
# Patch INSERT
|
2023-08-22 20:41:44 +01:00
|
|
|
case [["INSERT", "CHECKBOX"], [in_num, channel]]:
|
2023-09-16 20:28:07 +01:00
|
|
|
index = util.get_insert_checkbox_index(
|
2023-08-23 00:27:12 +01:00
|
|
|
self.kind,
|
|
|
|
int(channel),
|
|
|
|
int(in_num[-1]),
|
|
|
|
)
|
2023-08-22 20:41:44 +01:00
|
|
|
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
|
|
|
self.vm.patch.insert[index].on = val
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(f"{'on' if val else 'off'}")
|
2023-08-22 20:41:44 +01:00
|
|
|
case [["INSERT", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
2023-09-16 20:28:07 +01:00
|
|
|
index = util.get_insert_checkbox_index(
|
2023-09-14 13:46:26 +01:00
|
|
|
self.kind,
|
|
|
|
int(channel),
|
|
|
|
int(in_num[-1]),
|
|
|
|
)
|
|
|
|
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
|
2023-09-16 20:28:07 +01:00
|
|
|
channel = util._patch_insert_channels[int(channel)]
|
2023-09-14 13:46:26 +01:00
|
|
|
num = int(in_num[-1])
|
|
|
|
self.nvda.speak(f"Patch INSERT IN#{num} {channel} {'on' if val else 'off'}")
|
2023-08-26 00:11:05 +01:00
|
|
|
|
2023-09-11 07:51:16 +01:00
|
|
|
# Advanced Settings
|
|
|
|
case ["ADVANCED SETTINGS"] | ["CTRL-A"]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if values["tabgroup"] == "tab||Settings":
|
2023-09-20 10:01:48 +01:00
|
|
|
self.popup.advanced_settings(title="Advanced Settings")
|
2023-09-13 12:16:28 +01:00
|
|
|
case [["ADVANCED", "SETTINGS"], ["FOCUS", "IN"]]:
|
|
|
|
self.nvda.speak("ADVANCED SETTINGS")
|
2023-09-11 07:51:16 +01:00
|
|
|
case [["ADVANCED", "SETTINGS"], ["KEY", "ENTER"]]:
|
|
|
|
self.find_element_with_focus().click()
|
2023-08-26 21:55:39 +01:00
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Strip Params
|
|
|
|
case [["STRIP", index], [param]]:
|
2023-09-05 05:30:46 +01:00
|
|
|
label = self.cache["labels"][f"STRIP {index}||LABEL"]
|
2023-09-06 00:03:12 +01:00
|
|
|
match param:
|
|
|
|
case "MONO":
|
|
|
|
if int(index) < self.kind.phys_in:
|
|
|
|
actual = param.lower()
|
2023-09-06 15:27:55 +01:00
|
|
|
elif int(index) == self.kind.phys_in + 1:
|
2023-09-06 00:03:12 +01:00
|
|
|
actual = "k"
|
|
|
|
else:
|
|
|
|
actual = "mc"
|
|
|
|
phonetic = {"k": "karaoke"}
|
|
|
|
if actual == "k":
|
|
|
|
next_val = self.vm.strip[int(index)].k + 1
|
|
|
|
if next_val == 4:
|
|
|
|
next_val = 0
|
|
|
|
setattr(self.vm.strip[int(index)], actual, next_val)
|
|
|
|
self.cache["strip"][f"STRIP {index}||{param}"] = next_val
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(["off", "k m", "k 1", "k 2"][next_val])
|
2023-09-06 00:03:12 +01:00
|
|
|
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
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak("on" if val else "off")
|
2023-09-06 00:03:12 +01:00
|
|
|
case _:
|
|
|
|
val = not self.cache["strip"][f"STRIP {index}||{param}"]
|
|
|
|
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
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak("on" if val else "off")
|
2023-09-06 00:03:12 +01:00
|
|
|
case [["STRIP", index], [param], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
val = self.cache["strip"][f"STRIP {index}||{param}"]
|
|
|
|
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"]
|
|
|
|
if actual == "k":
|
|
|
|
self.nvda.speak(
|
|
|
|
f"{label} {phonetic.get(actual, actual)} {['off', 'k m', 'k 1', 'k 2'][self.cache['strip'][f'STRIP {int(index)}||{param}']]}"
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
self.nvda.speak(f"{label} {phonetic.get(actual, actual)} {'on' if val else 'off'}")
|
2023-09-06 00:03:12 +01:00
|
|
|
case [["STRIP", index], [param], ["KEY", "ENTER"]]:
|
2023-08-28 20:27:06 +01:00
|
|
|
self.find_element_with_focus().click()
|
2023-08-26 20:22:46 +01:00
|
|
|
|
2023-09-15 10:55:22 +01:00
|
|
|
# Strip Sliders
|
2023-09-17 11:25:11 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 11:44:15 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN"
|
|
|
|
| "COMP"
|
|
|
|
| "GATE"
|
|
|
|
| "DENOISER"
|
|
|
|
| "AUDIBILITY"
|
|
|
|
| "LIMIT"
|
|
|
|
| "BASS"
|
|
|
|
| "MID"
|
|
|
|
| "TREBLE" as param,
|
|
|
|
],
|
2023-09-17 11:25:11 +01:00
|
|
|
]:
|
|
|
|
val = values[event]
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
|
|
|
self.vm.strip[int(index)].gain = val
|
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
|
|
|
target = getattr(self.vm.strip[int(index)], param.lower())
|
|
|
|
target.knob = val
|
|
|
|
case "AUDIBILITY":
|
|
|
|
self.vm.strip[int(index)].audibility = val
|
|
|
|
case "LIMIT":
|
|
|
|
val = int(val)
|
|
|
|
self.vm.strip[int(index)].limit = val
|
2023-09-17 11:44:15 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
|
|
|
setattr(self.vm.strip[int(index)], param.lower(), val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 11:44:15 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN"
|
|
|
|
| "COMP"
|
|
|
|
| "GATE"
|
|
|
|
| "DENOISER"
|
|
|
|
| "AUDIBILITY"
|
|
|
|
| "LIMIT"
|
|
|
|
| "BASS"
|
|
|
|
| "MID"
|
|
|
|
| "TREBLE" as param,
|
|
|
|
],
|
2023-09-17 11:25:11 +01:00
|
|
|
["FOCUS", "IN"],
|
|
|
|
]:
|
2023-09-15 10:55:22 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
self.vm.event.pdirty = False
|
2023-09-17 11:25:11 +01:00
|
|
|
val = values[f"STRIP {index}||SLIDER {param}"]
|
2023-09-19 23:19:39 +01:00
|
|
|
label = self.cache["labels"][f"STRIP {index}||LABEL"]
|
|
|
|
self.nvda.speak(f"{label} {param} {int(val) if param == 'LIMIT' else val}")
|
2023-09-17 11:25:11 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 12:09:38 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN" | "COMP" | "GATE" | "DENOISER" | "AUDIBILITY" | "LIMIT" | "BASS" | "MID" | "TREBLE",
|
|
|
|
],
|
2023-09-17 11:25:11 +01:00
|
|
|
["FOCUS", "OUT"],
|
|
|
|
]:
|
2023-09-15 10:55:22 +01:00
|
|
|
self.vm.event.pdirty = True
|
2023-09-17 11:25:11 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 11:44:15 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN"
|
|
|
|
| "COMP"
|
|
|
|
| "GATE"
|
|
|
|
| "DENOISER"
|
|
|
|
| "AUDIBILITY"
|
|
|
|
| "LIMIT"
|
|
|
|
| "BASS"
|
|
|
|
| "MID"
|
|
|
|
| "TREBLE" as param,
|
|
|
|
],
|
2023-09-17 11:25:11 +01:00
|
|
|
["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
|
|
|
|
]:
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
|
|
|
val = self.vm.strip[int(index)].gain
|
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
|
|
|
target = getattr(self.vm.strip[int(index)], param.lower())
|
|
|
|
val = target.knob
|
|
|
|
case "AUDIBILITY":
|
|
|
|
val = self.vm.strip[int(index)].audibility
|
2023-09-17 11:44:15 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
|
|
|
val = getattr(self.vm.strip[int(index)], param.lower())
|
2023-09-17 12:23:04 +01:00
|
|
|
case "LIMIT":
|
|
|
|
val = self.vm.strip[int(index)].limit
|
2023-09-17 11:25:11 +01:00
|
|
|
|
2023-09-15 12:35:10 +01:00
|
|
|
match direction:
|
2023-09-15 19:12:07 +01:00
|
|
|
case "RIGHT" | "UP":
|
|
|
|
val += 1
|
|
|
|
case "LEFT" | "DOWN":
|
|
|
|
val -= 1
|
2023-09-17 11:25:11 +01:00
|
|
|
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.strip[int(index)].gain = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
setattr(target, "knob", val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case "AUDIBILITY":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
self.vm.strip[int(index)].audibility = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:44:15 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-12, 12))
|
|
|
|
setattr(self.vm.strip[int(index)], param.lower(), val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 12:23:04 +01:00
|
|
|
case "LIMIT":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-40, 12))
|
|
|
|
self.vm.strip[int(index)].limit = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
|
|
|
self.nvda.speak(str(val))
|
2023-09-15 12:35:10 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 12:23:04 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN"
|
|
|
|
| "COMP"
|
|
|
|
| "GATE"
|
|
|
|
| "DENOISER"
|
|
|
|
| "AUDIBILITY"
|
|
|
|
| "LIMIT"
|
|
|
|
| "BASS"
|
|
|
|
| "MID"
|
|
|
|
| "TREBLE" as param,
|
|
|
|
],
|
2023-09-15 12:35:10 +01:00
|
|
|
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
|
|
|
|
]:
|
2023-09-17 11:25:11 +01:00
|
|
|
match param:
|
|
|
|
case "GAIN":
|
|
|
|
val = self.vm.strip[int(index)].gain
|
2023-09-17 12:07:14 +01:00
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
|
|
|
target = getattr(self.vm.strip[int(index)], param.lower())
|
|
|
|
val = target.knob
|
2023-09-17 12:23:04 +01:00
|
|
|
case "AUDIBILITY":
|
|
|
|
val = self.vm.strip[int(index)].audibility
|
|
|
|
case "BASS" | "MID" | "TREBLE":
|
|
|
|
val = getattr(self.vm.strip[int(index)], param.lower())
|
2023-09-17 11:25:11 +01:00
|
|
|
case "LIMIT":
|
|
|
|
val = self.vm.strip[int(index)].limit
|
|
|
|
|
2023-09-15 12:35:10 +01:00
|
|
|
match direction:
|
2023-09-15 19:12:07 +01:00
|
|
|
case "RIGHT" | "UP":
|
2023-09-17 12:23:04 +01:00
|
|
|
if param in ("COMP", "GATE", "DENOISER", "AUDIBILITY", "BASS", "MID", "TREBLE"):
|
2023-09-17 11:44:15 +01:00
|
|
|
val += 1
|
|
|
|
else:
|
|
|
|
val += 3
|
2023-09-15 19:12:07 +01:00
|
|
|
case "LEFT" | "DOWN":
|
2023-09-17 12:23:04 +01:00
|
|
|
if param in ("COMP", "GATE", "DENOISER", "AUDIBILITY", "BASS", "MID", "TREBLE"):
|
2023-09-17 11:44:15 +01:00
|
|
|
val -= 1
|
|
|
|
else:
|
|
|
|
val -= 3
|
2023-09-17 11:25:11 +01:00
|
|
|
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.strip[int(index)].gain = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 12:07:14 +01:00
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
setattr(target, "knob", val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 12:23:04 +01:00
|
|
|
case "AUDIBILITY":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
self.vm.strip[int(index)].audibility = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:44:15 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-12, 12))
|
|
|
|
setattr(self.vm.strip[int(index)], param.lower(), val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 12:07:14 +01:00
|
|
|
case "LIMIT":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-40, 12))
|
|
|
|
self.vm.strip[int(index)].limit = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
|
|
|
self.nvda.speak(f"{param} {val}")
|
2023-09-15 12:35:10 +01:00
|
|
|
case [
|
|
|
|
["STRIP", index],
|
2023-09-17 12:23:04 +01:00
|
|
|
[
|
|
|
|
"SLIDER",
|
|
|
|
"GAIN"
|
|
|
|
| "COMP"
|
|
|
|
| "GATE"
|
|
|
|
| "DENOISER"
|
|
|
|
| "AUDIBILITY"
|
|
|
|
| "LIMIT"
|
|
|
|
| "BASS"
|
|
|
|
| "MID"
|
|
|
|
| "TREBLE" as param,
|
|
|
|
],
|
2023-09-15 12:35:10 +01:00
|
|
|
["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
|
|
|
|
]:
|
2023-09-17 11:25:11 +01:00
|
|
|
match param:
|
|
|
|
case "GAIN":
|
|
|
|
val = self.vm.strip[int(index)].gain
|
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
|
|
|
target = getattr(self.vm.strip[int(index)], param.lower())
|
|
|
|
val = target.knob
|
|
|
|
case "AUDIBILITY":
|
|
|
|
val = self.vm.strip[int(index)].audibility
|
2023-09-17 12:23:04 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
|
|
|
val = getattr(self.vm.strip[int(index)], param.lower())
|
2023-09-17 11:25:11 +01:00
|
|
|
case "LIMIT":
|
|
|
|
val = self.vm.strip[int(index)].limit
|
|
|
|
|
2023-09-15 19:12:07 +01:00
|
|
|
match direction:
|
|
|
|
case "RIGHT" | "UP":
|
2023-09-17 11:25:11 +01:00
|
|
|
if param == "LIMIT":
|
|
|
|
val += 1
|
|
|
|
else:
|
|
|
|
val += 0.1
|
2023-09-15 19:12:07 +01:00
|
|
|
case "LEFT" | "DOWN":
|
2023-09-17 11:25:11 +01:00
|
|
|
if param == "LIMIT":
|
|
|
|
val -= 1
|
|
|
|
else:
|
|
|
|
val -= 0.1
|
|
|
|
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.strip[int(index)].gain = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
setattr(target, "knob", val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case "AUDIBILITY":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (0, 10))
|
|
|
|
self.vm.strip[int(index)].audibility = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 12:23:04 +01:00
|
|
|
case "BASS" | "MID" | "TREBLE":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-12, 12))
|
|
|
|
setattr(self.vm.strip[int(index)], param.lower(), val)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
2023-09-17 11:25:11 +01:00
|
|
|
case "LIMIT":
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-40, 12))
|
|
|
|
self.vm.strip[int(index)].limit = val
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
|
|
|
|
self.nvda.speak(f"{param} {val}")
|
2023-09-18 09:12:12 +01:00
|
|
|
case [["STRIP", index], ["SLIDER", param], ["KEY", "CTRL", "SHIFT", "R"]]:
|
|
|
|
match param:
|
|
|
|
case "GAIN":
|
|
|
|
self.vm.strip[int(index)].gain = 0
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=0)
|
|
|
|
case "COMP" | "GATE" | "DENOISER":
|
|
|
|
setattr(target, "knob", 0)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=0)
|
|
|
|
case "AUDIBILITY":
|
|
|
|
self.vm.strip[int(index)].audibility = 0
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=0)
|
|
|
|
case "BASS" | "MID" | "TREBLE":
|
|
|
|
setattr(self.vm.strip[int(index)], param.lower(), 0)
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=0)
|
|
|
|
case "LIMIT":
|
|
|
|
self.vm.strip[int(index)].limit = 12
|
|
|
|
self[f"STRIP {index}||SLIDER {param}"].update(value=12)
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(f"{param} {12 if param == 'LABEL' else 0}")
|
2023-09-15 10:55:22 +01:00
|
|
|
|
2023-09-06 00:03:12 +01:00
|
|
|
# Bus Params
|
|
|
|
case [["BUS", index], [param]]:
|
|
|
|
val = self.cache["bus"][event]
|
2023-09-05 05:30:46 +01:00
|
|
|
label = self.cache["labels"][f"BUS {index}||LABEL"]
|
2023-09-06 00:03:12 +01:00
|
|
|
match param:
|
|
|
|
case "EQ":
|
|
|
|
val = not val
|
|
|
|
self.vm.bus[int(index)].eq.on = val
|
|
|
|
self.cache["bus"][event] = val
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-19 23:19:39 +01:00
|
|
|
"on" if val else "off",
|
2023-09-06 00:03:12 +01:00
|
|
|
)
|
|
|
|
case "MONO" | "MUTE":
|
|
|
|
val = not val
|
|
|
|
setattr(self.vm.bus[int(index)], param.lower(), val)
|
|
|
|
self.cache["bus"][event] = val
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-19 23:19:39 +01:00
|
|
|
"on" if val else "off",
|
2023-09-06 00:03:12 +01:00
|
|
|
)
|
|
|
|
case "MODE":
|
2023-09-16 20:28:07 +01:00
|
|
|
bus_modes = util.get_bus_modes(self.vm)
|
2023-09-06 00:03:12 +01:00
|
|
|
next_index = bus_modes.index(val) + 1
|
|
|
|
if next_index == len(bus_modes):
|
|
|
|
next_index = 0
|
|
|
|
next_bus = bus_modes[next_index]
|
|
|
|
phonetic = {
|
|
|
|
"amix": "Mix Down A",
|
|
|
|
"bmix": "Mix Down B",
|
|
|
|
"repeat": "Stereo Repeat",
|
|
|
|
"tvmix": "Up Mix TV",
|
|
|
|
"upmix21": "Up Mix 2.1",
|
|
|
|
"upmix41": "Up Mix 4.1",
|
|
|
|
"upmix61": "Up Mix 6.1",
|
|
|
|
"centeronly": "Center Only",
|
|
|
|
"lfeonly": "Low Frequency Effect Only",
|
|
|
|
"rearonly": "Rear Only",
|
|
|
|
}
|
|
|
|
setattr(self.vm.bus[int(index)].mode, next_bus, True)
|
|
|
|
self.cache["bus"][event] = next_bus
|
|
|
|
self.TKroot.after(
|
|
|
|
200,
|
|
|
|
self.nvda.speak,
|
2023-09-19 23:19:39 +01:00
|
|
|
phonetic.get(next_bus, next_bus),
|
2023-09-06 00:03:12 +01:00
|
|
|
)
|
|
|
|
case [["BUS", index], [param], ["FOCUS", "IN"]]:
|
2023-09-14 13:46:26 +01:00
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
label = self.cache["labels"][f"BUS {index}||LABEL"]
|
|
|
|
val = self.cache["bus"][f"BUS {index}||{param}"]
|
|
|
|
if param == "MODE":
|
|
|
|
self.nvda.speak(f"{label} bus {param} {val}")
|
|
|
|
else:
|
|
|
|
self.nvda.speak(f"{label} bus {param} {'on' if val else 'off'}")
|
2023-09-06 00:03:12 +01:00
|
|
|
case [["BUS", index], [param], ["KEY", "ENTER"]]:
|
2023-09-04 07:40:14 +01:00
|
|
|
self.find_element_with_focus().click()
|
2023-08-26 20:22:46 +01:00
|
|
|
|
2023-09-15 10:55:22 +01:00
|
|
|
# Bus Sliders
|
|
|
|
case [["BUS", index], ["SLIDER", "GAIN"]]:
|
|
|
|
label = self.cache["labels"][f"BUS {index}||LABEL"]
|
|
|
|
val = values[event]
|
|
|
|
self.vm.bus[int(index)].gain = val
|
|
|
|
case [["BUS", index], ["SLIDER", "GAIN"], ["FOCUS", "IN"]]:
|
|
|
|
if self.find_element_with_focus() is not None:
|
|
|
|
self.vm.event.pdirty = False
|
|
|
|
label = self.cache["labels"][f"BUS {index}||LABEL"]
|
|
|
|
val = values[f"BUS {index}||SLIDER GAIN"]
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(f"{label} gain {val}")
|
2023-09-15 10:55:22 +01:00
|
|
|
case [["BUS", index], ["SLIDER", "GAIN"], ["FOCUS", "OUT"]]:
|
|
|
|
self.vm.event.pdirty = True
|
2023-09-15 12:35:10 +01:00
|
|
|
case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction]]:
|
2023-09-15 19:12:07 +01:00
|
|
|
val = self.vm.bus[int(index)].gain
|
2023-09-15 12:35:10 +01:00
|
|
|
match direction:
|
2023-09-15 19:12:07 +01:00
|
|
|
case "RIGHT" | "UP":
|
|
|
|
val += 1
|
|
|
|
case "LEFT" | "DOWN":
|
|
|
|
val -= 1
|
2023-09-20 16:29:42 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.bus[int(index)].gain = val
|
2023-09-15 11:35:27 +01:00
|
|
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
2023-09-20 16:29:42 +01:00
|
|
|
self.nvda.speak(str(val))
|
2023-09-15 12:35:10 +01:00
|
|
|
case [
|
|
|
|
["BUS", index],
|
|
|
|
["SLIDER", "GAIN"],
|
|
|
|
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
|
|
|
|
]:
|
2023-09-15 19:12:07 +01:00
|
|
|
val = self.vm.bus[int(index)].gain
|
2023-09-15 12:35:10 +01:00
|
|
|
match direction:
|
2023-09-15 19:12:07 +01:00
|
|
|
case "RIGHT" | "UP":
|
|
|
|
val += 3
|
|
|
|
case "LEFT" | "DOWN":
|
|
|
|
val -= 3
|
2023-09-19 23:19:39 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.bus[int(index)].gain = val
|
2023-09-15 12:35:10 +01:00
|
|
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(str(val))
|
2023-09-15 12:35:10 +01:00
|
|
|
case [
|
|
|
|
["BUS", index],
|
|
|
|
["SLIDER", "GAIN"],
|
|
|
|
["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction],
|
|
|
|
]:
|
2023-09-15 19:12:07 +01:00
|
|
|
val = self.vm.bus[int(index)].gain
|
|
|
|
match direction:
|
|
|
|
case "RIGHT" | "UP":
|
|
|
|
val += 0.1
|
|
|
|
case "LEFT" | "DOWN":
|
|
|
|
val -= 0.1
|
2023-09-20 16:29:42 +01:00
|
|
|
val = util.check_bounds(val, (-60, 12))
|
|
|
|
self.vm.bus[int(index)].gain = val
|
2023-09-15 11:35:27 +01:00
|
|
|
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(str(val))
|
2023-09-18 09:12:12 +01:00
|
|
|
case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "CTRL", "SHIFT", "R"]]:
|
|
|
|
self.vm.bus[int(index)].gain = 0
|
|
|
|
self[f"BUS {index}||SLIDER GAIN"].update(value=0)
|
2023-09-19 23:19:39 +01:00
|
|
|
self.nvda.speak(str(val))
|
2023-09-15 10:55:22 +01:00
|
|
|
|
2023-08-26 20:22:46 +01:00
|
|
|
# Unknown
|
2023-08-22 02:04:00 +01:00
|
|
|
case _:
|
2023-09-05 05:43:38 +01:00
|
|
|
self.logger.debug(f"Unknown event {event}")
|
2023-08-26 19:46:39 +01:00
|
|
|
self.logger.debug(f"parsed::{parsed_cmd}")
|
2023-08-22 02:04:00 +01:00
|
|
|
|
|
|
|
|
2023-08-28 03:25:39 +01:00
|
|
|
def request_window_object(kind_id, vm):
|
2023-08-25 20:23:21 +01:00
|
|
|
NVDAVMWindow_cls = NVDAVMWindow
|
2023-08-28 03:25:39 +01:00
|
|
|
return NVDAVMWindow_cls(f"Voicemeeter {kind_id.capitalize()} NVDA", vm)
|