Compare commits

..

No commits in common. "a19aab393624479298f91de6c40b421ab43fc5fa" and "d722154325d02b321da3e580ec4653c5a222cfbc" have entirely different histories.

8 changed files with 215 additions and 404 deletions

View File

@ -8,7 +8,7 @@ A remote control app for [Voicemeeter][voicemeeter], designed to be used with th
For an outline of this projects goals see the [SPECIFICATION][spec].
<img src="./img/nvda-voicemeeter.png" width=960 alt="Image of Voicemeeter NVDA app settings tab">
<img src="./img/settings.png" width=350 alt="Image of Voicemeeter NVDA app settings tab">
## Requirements
@ -57,7 +57,7 @@ import nvda_voicemeeter
KIND_ID = "potato"
with voicemeeterlib.api(KIND_ID) as vm:
with voicemeeterlib.api(KIND_ID, sync=True) as vm:
with nvda_voicemeeter.draw(KIND_ID, vm) as window:
window.run()
```
@ -94,17 +94,7 @@ To adjust Patch Asio Inputs to Strips and Patch Insert values use `UP` and `DOWN
To access Advanced Settings you may press the Advanced Settings button or use `Control + A` when in the `Settings` tab.
#### `Physical Strip|Virtual Strip|Buses`
You will find in each of these tabs two nested tabs,`Buttons` and `Sliders`. For each nested tab you will find the controls appropriate for the Voicemeeter kind and channel type.
All buttons may be triggered by pressing `SPACE` or `ENTER`.
All sliders may be controlled in three different ways:
- `Left|Right arrow` to move a slider by 1 step.
- `Shift + Left|Right arrow` to move a slider by 0.1 steps.
- `Control + Left|Right arrow` to move a slider by 3 steps.
#### `Strip/Bus`
To rename a strip/bus channel navigate to the relevant tab, then press `F2`. This will open a popup window where you can set the channel index (with a spinbox) and set the new label using a text input box.
@ -124,30 +114,6 @@ The `Save Settings` option opens a popup window with two buttons, `Browse` and `
`Load Settings` and `Load on Startup` both open an Open dialog box immediately.
### `Quick access binds`
There are a number of quick binds available to assist with faster navigation and general use.
When focused on any one of "Physical Strip", "Virtual Strip" or "Buses" you may use `Control + Number` to skip to the corresponding channel.
When focused on any single channel (Strip or Bus), the following binds exist:
- `Alt + Number` will trigger the Bus output button corresponding to the number. For example `Alt + 3` will trigger the `A3` button
- `Control + O` will trigger the Mono button
- `Control + S` will trigger the Solo button
- `Control + M` will trigger the Mute button
You may also enter slider modes which allow for control of the channels sliders until the slider mode is exited. You may access the slider modes with the following binds:
- `Control + U` will enter Audibility mode
- `Control + G` will enter Gain mode
- `Control + T` will enter Gate mode
- `Control + L` will enter Limit mode
To exit any of the slider modes press `Escape`.
Once you are in a slider mode you may now control the slider that matches the slider mode. Slider mode binds are the same as the normal slider binds with the addition of the Alt keypress. For example, where you would normally use `Right Arrow` to shift a slider rightwards by 1 step, in slider mode you would now use `Alt + Right Arrow`.
### Issues
If you have any questions/suggestions feel free to raise an issue or open a new discussion.

View File

@ -4,6 +4,6 @@ import nvda_voicemeeter
KIND_ID = "potato"
with voicemeeterlib.api(KIND_ID) as vm:
with voicemeeterlib.api(KIND_ID, sync=True) as vm:
with nvda_voicemeeter.draw(KIND_ID, vm) as window:
window.run()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 KiB

View File

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

View File

@ -332,7 +332,7 @@ class Builder:
psg.Slider(
range=(-40, 12),
default_value=self.vm.strip[i].limit,
resolution=1,
resolution=0.1,
disable_number_display=True,
expand_x=True,
enable_events=True,
@ -433,7 +433,7 @@ class Builder:
psg.Slider(
range=(-40, 12),
default_value=self.vm.strip[i].limit,
resolution=1,
resolution=0.1,
disable_number_display=True,
expand_x=True,
enable_events=True,

View File

@ -10,13 +10,17 @@ class LabelSlider(psg.Frame):
size = 7
else:
size = 4
if param == "LIMIT":
resolution = 1
else:
resolution = 0.1
layout = [
[
psg.Text(param.capitalize(), size=size),
psg.Slider(
range=range_,
default_value=self.default_value(i, param),
resolution=0.1,
resolution=resolution,
disable_number_display=True,
size=(12, 16),
expand_x=True,

View File

@ -1,164 +0,0 @@
import logging
from pathlib import Path
import PySimpleGUI as psg
from . import util
logger = logging.getLogger(__name__)
class Popup:
def __init__(self, window):
self.window = window
self.logger = logger.getChild(type(self).__name__)
def save_as(self, message, title=None, initial_folder=None):
layout = [
[psg.Text(message)],
[
psg.FileSaveAs("Browse", initial_folder=str(initial_folder), file_types=(("XML", ".xml"),)),
psg.Button("Cancel"),
],
]
popup = psg.Window(title, layout, finalize=True)
popup["Browse"].bind("<FocusIn>", "||FOCUS IN")
popup["Browse"].bind("<Return>", "||KEY ENTER")
popup["Cancel"].bind("<FocusIn>", "||FOCUS IN")
popup["Cancel"].bind("<Return>", "||KEY ENTER")
filepath = None
while True:
event, values = popup.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Cancel"):
break
match parsed_cmd := self.window.parser.match.parseString(event):
case [[button], ["FOCUS", "IN"]]:
if values["Browse"]:
filepath = values["Browse"]
break
self.window.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
popup.close()
if filepath:
return Path(filepath)
def rename(self, message, title=None, tab=None):
if tab == "Physical Strip":
upper = self.window.kind.phys_in + 1
elif tab == "Virtual Strip":
upper = self.window.kind.virt_in + 1
elif tab == "Buses":
upper = self.window.kind.num_bus + 1
layout = [
[psg.Text(message)],
[
[
psg.Spin(
list(range(1, upper)), initial_value=1, size=2, enable_events=True, key=f"Index", readonly=True
),
psg.Input(key="Edit"),
],
[psg.Button("Ok"), psg.Button("Cancel")],
],
]
popup = psg.Window(title, layout, finalize=True)
popup["Index"].bind("<FocusIn>", "||FOCUS IN")
popup["Edit"].bind("<FocusIn>", "||FOCUS IN")
popup["Ok"].bind("<FocusIn>", "||FOCUS IN")
popup["Ok"].bind("<Return>", "||KEY ENTER")
popup["Cancel"].bind("<FocusIn>", "||FOCUS IN")
popup["Cancel"].bind("<Return>", "||KEY ENTER")
data = {}
while True:
event, values = popup.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Cancel"):
break
match parsed_cmd := self.window.parser.match.parseString(event):
case ["Index"]:
val = values["Index"]
self.window.nvda.speak(f"Index {val}")
case [[button], ["FOCUS", "IN"]]:
if button == "Index":
val = values["Index"]
self.window.nvda.speak(f"Index {val}")
else:
self.window.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
popup.find_element_with_focus().click()
case ["Ok"]:
data = values
break
self.logger.debug(f"parsed::{parsed_cmd}")
popup.close()
return data
def advanced_settings(self, title):
def _make_buffering_frame() -> psg.Frame:
buffer = [
[
psg.ButtonMenu(
driver,
size=(14, 2),
menu_def=["", util.get_asio_samples_list(driver)],
key=f"BUFFER {driver}",
)
for driver in ("MME", "WDM", "KS", "ASIO")
],
]
return psg.Frame("BUFFERING", buffer)
layout = []
steps = (_make_buffering_frame,)
for step in steps:
layout.append([step()])
layout.append([psg.Button("Exit", size=(8, 2))])
popup = psg.Window(title, layout, finalize=True)
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
for driver in ("MME", "WDM", "KS", "ASIO"):
popup[f"BUFFER {driver}"].Widget.config(**buttonmenu_opts)
popup[f"BUFFER {driver}"].bind("<FocusIn>", "||FOCUS IN")
popup[f"BUFFER {driver}"].bind("<space>", "||KEY SPACE", propagate=False)
popup[f"BUFFER {driver}"].bind("<Return>", "||KEY ENTER", propagate=False)
popup["Exit"].bind("<FocusIn>", "||FOCUS IN")
popup["Exit"].bind("<Return>", "||KEY ENTER")
while True:
event, values = popup.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Exit"):
break
match parsed_cmd := self.window.parser.match.parseString(event):
case ["BUFFER MME" | "BUFFER WDM" | "BUFFER KS" | "BUFFER ASIO"]:
if values[event] == "Default":
if "MME" in event:
val = 1024
elif "WDM" in event or "KS" in event:
val = 512
else:
val = 0
else:
val = int(values[event])
driver = event.split()[1]
self.window.vm.set(f"option.buffer.{driver.lower()}", val)
self.window.TKroot.after(
200, self.window.nvda.speak, f"{driver} BUFFER {val if val else 'default'}"
)
case [["BUFFER", driver], ["FOCUS", "IN"]]:
val = int(self.window.vm.get(f"option.buffer.{driver.lower()}"))
self.window.nvda.speak(f"{driver} BUFFER {val if val else 'default'}")
case [["BUFFER", driver], ["KEY", "SPACE" | "ENTER"]]:
util.open_context_menu_for_buttonmenu(popup, f"BUFFER {driver}")
case [[button], ["FOCUS", "IN"]]:
self.window.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
popup.close()

View File

@ -8,7 +8,6 @@ from . import models, util
from .builder import Builder
from .nvda import Nvda
from .parser import Parser
from .popup import Popup
logger = logging.getLogger(__name__)
@ -35,7 +34,6 @@ class NVDAVMWindow(psg.Window):
}
self.nvda = Nvda()
self.parser = Parser()
self.popup = Popup(self)
self.builder = Builder(self)
layout = self.builder.run()
super().__init__(title, layout, return_keyboard_events=True, finalize=True)
@ -138,37 +136,7 @@ class NVDAVMWindow(psg.Window):
self[f"tabgroup||{tabname}"].bind("<Shift-KeyPress-Tab>", "||KEY SHIFT TAB")
self.bind("<Control-KeyPress-Tab>", "CTRL-TAB")
self.bind("<Control-Shift-KeyPress-Tab>", "CTRL-SHIFT-TAB")
# NAV
self.bind("<Control-a>", "CTRL-A")
for i in range(1, 10):
self.bind(f"<Control-Key-{i}>", f"CTRL-{i}")
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")
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")
# Hardware In
for i in range(self.vm.kind.phys_in):
@ -277,13 +245,160 @@ class NVDAVMWindow(psg.Window):
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-KeyPress-Down>", "||KEY CTRL DOWN")
self[f"BUS {i}||SLIDER GAIN"].bind("<Control-Shift-KeyPress-R>", "||KEY CTRL SHIFT R")
def popup_save_as(self, message, title=None, initial_folder=None):
layout = [
[psg.Text(message)],
[
psg.FileSaveAs("Browse", initial_folder=str(initial_folder), file_types=(("XML", ".xml"),)),
psg.Button("Cancel"),
],
]
window = psg.Window(title, layout, finalize=True)
window["Browse"].bind("<FocusIn>", "||FOCUS IN")
window["Browse"].bind("<Return>", "||KEY ENTER")
window["Cancel"].bind("<FocusIn>", "||FOCUS IN")
window["Cancel"].bind("<Return>", "||KEY ENTER")
filepath = None
while True:
event, values = window.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Cancel"):
break
match parsed_cmd := self.parser.match.parseString(event):
case [[button], ["FOCUS", "IN"]]:
if values["Browse"]:
filepath = values["Browse"]
break
self.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
window.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
window.close()
if filepath:
return Path(filepath)
def popup_rename(self, message, title=None, tab=None):
if tab == "Physical Strip":
upper = self.kind.phys_in + 1
elif tab == "Virtual Strip":
upper = self.kind.virt_in + 1
elif tab == "Buses":
upper = self.kind.num_bus + 1
layout = [
[psg.Text(message)],
[
[
psg.Spin(
list(range(1, upper)), initial_value=1, size=2, enable_events=True, key=f"Index", readonly=True
),
psg.Input(key="Edit"),
],
[psg.Button("Ok"), psg.Button("Cancel")],
],
]
window = psg.Window(title, layout, finalize=True)
window["Index"].bind("<FocusIn>", "||FOCUS IN")
window["Edit"].bind("<FocusIn>", "||FOCUS IN")
window["Ok"].bind("<FocusIn>", "||FOCUS IN")
window["Ok"].bind("<Return>", "||KEY ENTER")
window["Cancel"].bind("<FocusIn>", "||FOCUS IN")
window["Cancel"].bind("<Return>", "||KEY ENTER")
data = {}
while True:
event, values = window.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Cancel"):
break
match parsed_cmd := self.parser.match.parseString(event):
case ["Index"]:
val = values["Index"]
self.nvda.speak(f"Index {val}")
case [[button], ["FOCUS", "IN"]]:
if button == "Index":
val = values["Index"]
self.nvda.speak(f"Index {val}")
else:
self.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
window.find_element_with_focus().click()
case ["Ok"]:
data = values
break
self.logger.debug(f"parsed::{parsed_cmd}")
window.close()
return data
def popup_advanced_settings(self, title):
def _make_buffering_frame() -> psg.Frame:
buffer = [
[
psg.ButtonMenu(
driver,
size=(14, 2),
menu_def=["", util.get_asio_samples_list(driver)],
key=f"BUFFER {driver}",
)
for driver in ("MME", "WDM", "KS", "ASIO")
],
]
return psg.Frame("BUFFERING", buffer)
layout = []
steps = (_make_buffering_frame,)
for step in steps:
layout.append([step()])
layout.append([psg.Button("Exit", size=(8, 2))])
window = psg.Window(title, layout, finalize=True)
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
for driver in ("MME", "WDM", "KS", "ASIO"):
window[f"BUFFER {driver}"].Widget.config(**buttonmenu_opts)
window[f"BUFFER {driver}"].bind("<FocusIn>", "||FOCUS IN")
window[f"BUFFER {driver}"].bind("<space>", "||KEY SPACE", propagate=False)
window[f"BUFFER {driver}"].bind("<Return>", "||KEY ENTER", propagate=False)
window["Exit"].bind("<FocusIn>", "||FOCUS IN")
window["Exit"].bind("<Return>", "||KEY ENTER")
while True:
event, values = window.read()
self.logger.debug(f"event::{event}")
self.logger.debug(f"values::{values}")
if event in (psg.WIN_CLOSED, "Exit"):
break
match parsed_cmd := self.parser.match.parseString(event):
case ["BUFFER MME" | "BUFFER WDM" | "BUFFER KS" | "BUFFER ASIO"]:
if values[event] == "Default":
if "MME" in event:
val = 1024
elif "WDM" in event or "KS" in event:
val = 512
else:
val = 0
else:
val = int(values[event])
driver = event.split()[1]
self.vm.set(f"option.buffer.{driver.lower()}", val)
self.TKroot.after(200, self.nvda.speak, f"{driver} BUFFER {val if val else 'default'}")
case [["BUFFER", driver], ["FOCUS", "IN"]]:
val = int(self.vm.get(f"option.buffer.{driver.lower()}"))
self.nvda.speak(f"{driver} BUFFER {val if val else 'default'}")
case [["BUFFER", driver], ["KEY", "SPACE" | "ENTER"]]:
util.open_context_menu_for_buttonmenu(window, f"BUFFER {driver}")
case [[button], ["FOCUS", "IN"]]:
self.nvda.speak(button)
case [[button], ["KEY", "ENTER"]]:
window.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
window.close()
def run(self):
"""
Parses the event string and matches it to events
Main thread will shutdown once a close or exit event occurs
"""
mode = None
while True:
event, values = self.read()
@ -291,18 +406,6 @@ 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"):
mode = event
self.nvda.speak(f"{mode} enabled")
elif event == "Escape:27":
if mode:
self.nvda.speak(f"{mode.split()[0]} mode disabled")
mode = None
if mode:
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
match parsed_cmd := self.parser.match.parseString(event):
# Focus tabgroup
@ -310,90 +413,11 @@ class NVDAVMWindow(psg.Window):
self["tabgroup"].set_focus()
self.nvda.speak(f"{values['tabgroup']}")
# 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":
if int(index) > self.kind.phys_in:
continue
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":
if int(index) > self.kind.num_bus:
continue
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()
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)
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("-")
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:
self.write_event_value(f"{identifier}||SLIDER {param}||KEY {' '.join(op)}", None)
# Rename popups
case ["F2:113"]:
tab = values["tabgroup"].split("||")[1]
tab = values["tabgroup"]
if tab in ("Physical Strip", "Virtual Strip", "Buses"):
data = self.popup.rename("Label", title=f"Rename {tab}", tab=tab)
data = self.popup_rename("Label", title=f"Rename {tab}", tab=tab)
if not data: # cancel was pressed
continue
index = int(data["Index"]) - 1
@ -429,7 +453,7 @@ class NVDAVMWindow(psg.Window):
)
case [["Save", "Settings"], ["MENU"]]:
initial_folder = Path.home() / "Documents" / "Voicemeeter"
if filepath := self.popup.save_as(
if filepath := self.popup_save_as(
"Open the file browser", title="Save As", initial_folder=initial_folder
):
self.vm.set("command.save", str(filepath))
@ -541,7 +565,7 @@ class NVDAVMWindow(psg.Window):
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
self.vm.patch.asio[index].set(val)
channel = ("left", "right")[int(channel)]
self.nvda.speak(str(val))
self.nvda.speak(f"Patch ASIO {in_num} {channel} set to {val}")
case [["ASIO", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]:
if self.find_element_with_focus() is not None:
val = values[f"ASIO CHECKBOX||{in_num} {channel}"]
@ -575,7 +599,9 @@ class NVDAVMWindow(psg.Window):
)
val = values[f"INSERT CHECKBOX||{in_num} {channel}"]
self.vm.patch.insert[index].on = val
self.nvda.speak(f"{'on' if val else 'off'}")
self.nvda.speak(
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"]]:
if self.find_element_with_focus() is not None:
index = util.get_insert_checkbox_index(
@ -591,7 +617,7 @@ class NVDAVMWindow(psg.Window):
# Advanced Settings
case ["ADVANCED SETTINGS"] | ["CTRL-A"]:
if values["tabgroup"] == "tab||Settings":
self.popup.advanced_settings(title="Advanced Settings")
self.popup_advanced_settings(title="Advanced Settings")
case [["ADVANCED", "SETTINGS"], ["FOCUS", "IN"]]:
self.nvda.speak("ADVANCED SETTINGS")
case [["ADVANCED", "SETTINGS"], ["KEY", "ENTER"]]:
@ -615,17 +641,19 @@ class NVDAVMWindow(psg.Window):
next_val = 0
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])
self.nvda.speak(
f"{label} {phonetic.get(actual, actual)} {['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")
self.nvda.speak(f"{label} {phonetic.get(actual, actual)} {'on' if val else 'off'}")
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
self.nvda.speak("on" if val else "off")
self.nvda.speak(f"{label} {param} {'on' if val else 'off'}")
case [["STRIP", index], [param], ["FOCUS", "IN"]]:
if self.find_element_with_focus() is not None:
val = self.cache["strip"][f"STRIP {index}||{param}"]
@ -666,6 +694,7 @@ class NVDAVMWindow(psg.Window):
| "TREBLE" as param,
],
]:
label = self.cache["labels"][f"STRIP {index}||LABEL"]
val = values[event]
match param:
case "GAIN":
@ -680,6 +709,7 @@ class NVDAVMWindow(psg.Window):
self.vm.strip[int(index)].limit = val
case "BASS" | "MID" | "TREBLE":
setattr(self.vm.strip[int(index)], param.lower(), val)
self.nvda.speak(f"{label} {param} slider {val}")
case [
["STRIP", index],
[
@ -698,9 +728,9 @@ class NVDAVMWindow(psg.Window):
]:
if self.find_element_with_focus() is not None:
self.vm.event.pdirty = False
val = values[f"STRIP {index}||SLIDER {param}"]
label = self.cache["labels"][f"STRIP {index}||LABEL"]
self.nvda.speak(f"{label} {param} {int(val) if param == 'LIMIT' else val}")
val = values[f"STRIP {index}||SLIDER {param}"]
self.nvda.speak(f"{label} {param} slider {int(val) if param == 'LIMIT' else val}")
case [
["STRIP", index],
[
@ -747,26 +777,20 @@ class NVDAVMWindow(psg.Window):
match param:
case "GAIN":
val = util.check_bounds(val, (-60, 12))
self.vm.strip[int(index)].gain = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-60, 12)))
case "COMP" | "GATE" | "DENOISER":
val = util.check_bounds(val, (0, 10))
setattr(target, "knob", val)
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
setattr(target, "knob", util.check_bounds(val, (0, 10)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "AUDIBILITY":
val = util.check_bounds(val, (0, 10))
self.vm.strip[int(index)].audibility = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].audibility = util.check_bounds(val, (0, 10))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "BASS" | "MID" | "TREBLE":
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)
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case "LIMIT":
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))
self.vm.strip[int(index)].limit = util.check_bounds(val, (-40, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-40, 12)))
case [
["STRIP", index],
[
@ -810,26 +834,20 @@ class NVDAVMWindow(psg.Window):
match param:
case "GAIN":
val = util.check_bounds(val, (-60, 12))
self.vm.strip[int(index)].gain = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-60, 12)))
case "COMP" | "GATE" | "DENOISER":
val = util.check_bounds(val, (0, 10))
setattr(target, "knob", val)
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
setattr(target, "knob", util.check_bounds(val, (0, 10)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "AUDIBILITY":
val = util.check_bounds(val, (0, 10))
self.vm.strip[int(index)].audibility = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].audibility = util.check_bounds(val, (0, 10))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "BASS" | "MID" | "TREBLE":
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)
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case "LIMIT":
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}")
self.vm.strip[int(index)].limit = util.check_bounds(val, (-40, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-40, 12)))
case [
["STRIP", index],
[
@ -873,26 +891,20 @@ class NVDAVMWindow(psg.Window):
match param:
case "GAIN":
val = util.check_bounds(val, (-60, 12))
self.vm.strip[int(index)].gain = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-60, 12)))
case "COMP" | "GATE" | "DENOISER":
val = util.check_bounds(val, (0, 10))
setattr(target, "knob", val)
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
setattr(target, "knob", util.check_bounds(val, (0, 10)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "AUDIBILITY":
val = util.check_bounds(val, (0, 10))
self.vm.strip[int(index)].audibility = val
self[f"STRIP {index}||SLIDER {param}"].update(value=val)
self.vm.strip[int(index)].audibility = util.check_bounds(val, (0, 10))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (0, 10)))
case "BASS" | "MID" | "TREBLE":
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)
setattr(self.vm.strip[int(index)], param.lower(), util.check_bounds(val, (-12, 12)))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-12, 12)))
case "LIMIT":
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}")
self.vm.strip[int(index)].limit = util.check_bounds(val, (-40, 12))
self[f"STRIP {index}||SLIDER {param}"].update(value=util.check_bounds(val, (-40, 12)))
case [["STRIP", index], ["SLIDER", param], ["KEY", "CTRL", "SHIFT", "R"]]:
match param:
case "GAIN":
@ -910,7 +922,6 @@ class NVDAVMWindow(psg.Window):
case "LIMIT":
self.vm.strip[int(index)].limit = 12
self[f"STRIP {index}||SLIDER {param}"].update(value=12)
self.nvda.speak(f"{param} {12 if param == 'LABEL' else 0}")
# Bus Params
case [["BUS", index], [param]]:
@ -924,7 +935,7 @@ class NVDAVMWindow(psg.Window):
self.TKroot.after(
200,
self.nvda.speak,
"on" if val else "off",
f"{label} bus {param} {'on' if val else 'off'}",
)
case "MONO" | "MUTE":
val = not val
@ -933,7 +944,7 @@ class NVDAVMWindow(psg.Window):
self.TKroot.after(
200,
self.nvda.speak,
"on" if val else "off",
f"{label} bus {param} {'on' if val else 'off'}",
)
case "MODE":
bus_modes = util.get_bus_modes(self.vm)
@ -958,7 +969,7 @@ class NVDAVMWindow(psg.Window):
self.TKroot.after(
200,
self.nvda.speak,
phonetic.get(next_bus, next_bus),
f"{label} bus mode {phonetic.get(next_bus, next_bus)}",
)
case [["BUS", index], [param], ["FOCUS", "IN"]]:
if self.find_element_with_focus() is not None:
@ -976,12 +987,13 @@ class NVDAVMWindow(psg.Window):
label = self.cache["labels"][f"BUS {index}||LABEL"]
val = values[event]
self.vm.bus[int(index)].gain = val
self.nvda.speak(f"{label} gain slider {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"]
self.nvda.speak(f"{label} gain {val}")
self.nvda.speak(f"{label} gain slider {val}")
case [["BUS", index], ["SLIDER", "GAIN"], ["FOCUS", "OUT"]]:
self.vm.event.pdirty = True
case [["BUS", index], ["SLIDER", "GAIN"], ["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as direction]]:
@ -991,10 +1003,8 @@ class NVDAVMWindow(psg.Window):
val += 1
case "LEFT" | "DOWN":
val -= 1
val = util.check_bounds(val, (-60, 12))
self.vm.bus[int(index)].gain = val
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
self.nvda.speak(str(val))
case [
["BUS", index],
["SLIDER", "GAIN"],
@ -1006,10 +1016,8 @@ class NVDAVMWindow(psg.Window):
val += 3
case "LEFT" | "DOWN":
val -= 3
val = util.check_bounds(val, (-60, 12))
self.vm.bus[int(index)].gain = val
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
self.nvda.speak(str(val))
case [
["BUS", index],
["SLIDER", "GAIN"],
@ -1021,14 +1029,11 @@ class NVDAVMWindow(psg.Window):
val += 0.1
case "LEFT" | "DOWN":
val -= 0.1
val = util.check_bounds(val, (-60, 12))
self.vm.bus[int(index)].gain = val
self.vm.bus[int(index)].gain = util.check_bounds(val, (-60, 12))
self[f"BUS {index}||SLIDER GAIN"].update(value=val)
self.nvda.speak(str(val))
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)
self.nvda.speak(str(val))
# Unknown
case _: