mirror of
https://github.com/onyx-and-iris/nvda-voicemeeter.git
synced 2026-04-07 09:53:35 +00:00
Compare commits
52 Commits
v0.1.2
...
implement-
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dd6c89f96 | |||
| 893f9f59ff | |||
| 3ca9e14e96 | |||
| 4ca64f94bc | |||
| 22bf109499 | |||
| a19aab3936 | |||
| 7134b6d209 | |||
| 1525710d31 | |||
| 2745e2c41a | |||
| 8716149eda | |||
| dde940938f | |||
| 09f052b4a3 | |||
| 577f1fbdbb | |||
| f9614f44ac | |||
| 9b757b743b | |||
| 7f8f6f2b6c | |||
| 0c806b8e4c | |||
| 645361c731 | |||
| 6baa0000c8 | |||
| d722154325 | |||
| c94d763569 | |||
| ac14b7ad0d | |||
| 78b7e01fa6 | |||
| 42fad86905 | |||
| 6c54d28210 | |||
| d958167ded | |||
| 0570138963 | |||
| 1fdb39a041 | |||
| 3d7b33c8be | |||
| cf5c8f81aa | |||
| c248808c7b | |||
| d93f078365 | |||
| e0f36b2411 | |||
| 719328c6de | |||
| 65a148aa7b | |||
| ba1fb28187 | |||
| e35bad9e1e | |||
| 804af85e65 | |||
| 96de917b64 | |||
| bc14116cd7 | |||
| 086fbc1b8c | |||
| 047577265c | |||
| 7ab7c30e80 | |||
| bfdc0306e3 | |||
| 245476adfd | |||
| 2562c02b7e | |||
| aaa2c72668 | |||
| 7648b68b85 | |||
| 14c6b937d1 | |||
| 5069db97da | |||
| 681bf8e85c | |||
| 8424558f3d |
100
README.md
100
README.md
@@ -6,9 +6,9 @@
|
||||
|
||||
A remote control app for [Voicemeeter][voicemeeter], designed to be used with the [NVDA screen reader][nvda].
|
||||
|
||||
This is still an early release but it should be usable.
|
||||
For an outline of this projects goals see the [SPECIFICATION][spec].
|
||||
|
||||
<img src="./img/settings.png" width=350 alt="Image of Voicemeeter NVDA app settings tab">
|
||||
<img src="./img/nvda-voicemeeter.png" width=960 alt="Image of Voicemeeter NVDA app settings tab">
|
||||
|
||||
## Requirements
|
||||
|
||||
@@ -18,11 +18,31 @@ This is still an early release but it should be usable.
|
||||
|
||||
### Installation
|
||||
|
||||
First clone the source files from this repository
|
||||
#### `From Source`
|
||||
|
||||
`git clone https://github.com/onyx-and-iris/nvda-voicemeeter.git`
|
||||
First clone the source files from this repository and install the dependencies.
|
||||
|
||||
Then download the [Controller Client][controller_client] and place the files into the directory `controllerClient`.
|
||||
```
|
||||
git clone https://github.com/onyx-and-iris/nvda-voicemeeter.git
|
||||
cd nvda-voicemeeter
|
||||
pip install .
|
||||
```
|
||||
|
||||
Then download the [Controller Client][controller_client] and place the dll files into the directory `controllerClient`.
|
||||
|
||||
Your directory structure should look like this:
|
||||
|
||||
├── `controllerClient/`
|
||||
|
||||
├── `x64/`
|
||||
|
||||
├── nvdaControllerClient64.dll
|
||||
|
||||
├── `x86/`
|
||||
|
||||
├── nvdaControllerClient32.dll
|
||||
|
||||
#### `From Releases`
|
||||
|
||||
If you want to get started quickly and easily I have uploaded some compiled versions of the app in the [Releases][releases] section.
|
||||
|
||||
@@ -37,12 +57,12 @@ import nvda_voicemeeter
|
||||
|
||||
KIND_ID = "potato"
|
||||
|
||||
with voicemeeterlib.api(KIND_ID, sync=True) as vm:
|
||||
with voicemeeterlib.api(KIND_ID) as vm:
|
||||
with nvda_voicemeeter.draw(KIND_ID, vm) as window:
|
||||
window.run()
|
||||
```
|
||||
|
||||
### `KIND_ID`
|
||||
### KIND_ID
|
||||
|
||||
May be one of the following:
|
||||
|
||||
@@ -52,24 +72,48 @@ May be one of the following:
|
||||
|
||||
### Use
|
||||
|
||||
The app presents four tabs `Settings`, `Physical Strip`, `Virtual Strip` and `Buses`. Navigate between the tabs with `Control + TAB` and `Control + SHIFT + TAB`.
|
||||
#### `Tabs`
|
||||
|
||||
The app presents four tabs `Settings`, `Physical Strip`, `Virtual Strip` and `Buses`. Navigate between the tabs with `Control + TAB` and `Control + SHIFT + TAB` or once focused on any tab, `Left` and `Right` arrow keys.
|
||||
|
||||
All controls within the tabs may be navigated between using `TAB`.
|
||||
|
||||
#### `Settings`
|
||||
|
||||
The following controls offer context menus accessed by pressing `SPACE` or `ENTER`:
|
||||
|
||||
- Hardware In
|
||||
- Hardware Out
|
||||
- Patch Composite
|
||||
|
||||
Press `ESCAPE` to exit any context menu.
|
||||
|
||||
All other buttons can be triggered by pressing `SPACE` or `ENTER`.
|
||||
|
||||
To adjust Patch Asio Inputs to Strips and Patch Insert values use `UP` and `DOWN` arrows when in focus.
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
To rename a strip/bus channel focus on the channel in question and press `F2`. Then enter the new channel name into the text input widget and press the `Ok` button.
|
||||
|
||||
Pressing the `OK` button with an empty text input will clear the label. In this case the label will be read as a default value for that channel. For example, if the leftmost Strip label were cleared, the screen reader will now read `Hardware Input 1`.
|
||||
|
||||
Pressing `Cancel` will close the popup window with no affect on the label.
|
||||
|
||||
#### `Menu`
|
||||
|
||||
A single menu item `Voicemeeter` can be opened using `Alt` and then `v`. The menu allows you to:
|
||||
|
||||
- Restart Voicemeeter audio engine
|
||||
@@ -80,10 +124,48 @@ 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
|
||||
- `Control + B` will enter Bass mode
|
||||
- `Control + I` will enter Mid mode
|
||||
- `Control + R` will enter Treble mode
|
||||
|
||||
To exit any of the slider modes press `Escape`.
|
||||
|
||||
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.
|
||||
|
||||
### Special Thanks
|
||||
|
||||
[Mario Loreti](https://www.marioloreti.net/en/) for his help in testing and offering feedback during development.
|
||||
|
||||
[NVAccess](https://www.nvaccess.org/) for creating the open source NVDA screen reader and its controller client.
|
||||
|
||||
[Vincent Burel](https://github.com/vburel2018) for creating Voicemeeter and its SDK.
|
||||
|
||||
[PySimpleGUI](https://github.com/PySimpleGUI) team for creating an awesome GUI framework.
|
||||
|
||||
[spec]: ./SPECIFICATION.md
|
||||
[voicemeeter]: https://voicemeeter.com/
|
||||
[nvda]: https://www.nvaccess.org/
|
||||
[controller_client]: https://github.com/nvaccess/nvda/tree/master/extras/controllerClient
|
||||
|
||||
30
SPECIFICATION.md
Normal file
30
SPECIFICATION.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Software Specification
|
||||
|
||||
## Description
|
||||
|
||||
A remote control utility for Voicemeeter designed to be used with the NVDA screen reader.
|
||||
|
||||
## Requirements
|
||||
|
||||
#### Functional Goals
|
||||
|
||||
- Parameter updates caused by user input should be read back to the user via the screen reader.
|
||||
- When focusing a control the current value for that control should be read back to the user.
|
||||
- The application should scale correctly according to each kind of Voicemeeter (basic, banana, potato). This means the following:
|
||||
- Correct number of strips/buses.
|
||||
- Correct number of bus assignments for each strip.
|
||||
- Where certain controls are valid for one kind they may not be for another.
|
||||
- Where possible set limits on data entry and keep controls appropriate for the type of parameter.
|
||||
|
||||
#### Accessibility Goals
|
||||
|
||||
- Every control must be usable with a keyboard.
|
||||
- Navigation around the application must be doable with a keyboard.
|
||||
- Should use standard Windows controls only.
|
||||
|
||||
## Limitations
|
||||
|
||||
- May not cover 100% of the Voicemeeter GUI, for example the many EQ parameters.
|
||||
- Only designed to work with the NVDA screen reader. Other screen readers not supported.
|
||||
- Only the main Voicemeeter GUI supported by this application. No support for Matrix or other Voicemeeter products.
|
||||
- Runs on Python version 3.10 or greater.
|
||||
@@ -4,6 +4,6 @@ import nvda_voicemeeter
|
||||
|
||||
KIND_ID = "potato"
|
||||
|
||||
with voicemeeterlib.api(KIND_ID, sync=True) as vm:
|
||||
with voicemeeterlib.api(KIND_ID) as vm:
|
||||
with nvda_voicemeeter.draw(KIND_ID, vm) as window:
|
||||
window.run()
|
||||
|
||||
BIN
img/nvda-voicemeeter.png
Normal file
BIN
img/nvda-voicemeeter.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 777 KiB |
2
pdm.lock
generated
2
pdm.lock
generated
@@ -6,7 +6,7 @@ groups = ["default", "build", "lint", "test"]
|
||||
cross_platform = true
|
||||
static_urls = false
|
||||
lock_version = "4.3"
|
||||
content_hash = "sha256:9051151ac4ac0edefdfaf52faa91dbff89d8bbc942a6ffa61b6ec6fee502aa8a"
|
||||
content_hash = "sha256:ba53368b628b713c9cf4eb54e6f5c5c4af207c8e247d473417e4c2a4b47f645d"
|
||||
|
||||
[[package]]
|
||||
name = "altgraph"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "nvda_voicemeeter"
|
||||
version = "0.1.2"
|
||||
version = "0.4.0"
|
||||
description = "A Voicemeeter app compatible with NVDA"
|
||||
authors = [
|
||||
{ name = "onyx-and-iris", email = "code@onyxandiris.online" },
|
||||
@@ -10,7 +10,7 @@ dependencies = [
|
||||
"pyparsing>=3.1.1",
|
||||
"voicemeeter-api>=2.4.9",
|
||||
]
|
||||
requires-python = ">=3.10,<3.11"
|
||||
requires-python = ">=3.10,<3.12"
|
||||
readme = "README.md"
|
||||
|
||||
[project.license]
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
import PySimpleGUI as psg
|
||||
|
||||
from .util import (
|
||||
get_asio_checkbox_index,
|
||||
get_asio_samples_list,
|
||||
get_input_device_list,
|
||||
get_insert_checkbox_index,
|
||||
get_output_device_list,
|
||||
get_patch_composite_list,
|
||||
get_tabs_labels,
|
||||
)
|
||||
from . import util
|
||||
from .compound import LabelSlider
|
||||
|
||||
|
||||
class Builder:
|
||||
@@ -27,6 +20,7 @@ class Builder:
|
||||
steps = (
|
||||
self.make_tab0_row0,
|
||||
self.make_tab0_row1,
|
||||
self.make_tab0_row5,
|
||||
)
|
||||
else:
|
||||
steps = (
|
||||
@@ -40,25 +34,61 @@ class Builder:
|
||||
for step in steps:
|
||||
layout0.append([step()])
|
||||
|
||||
layout1 = []
|
||||
steps = (self.make_tab1_rows,)
|
||||
layout1_1 = []
|
||||
steps = (self.make_tab1_button_rows,)
|
||||
for step in steps:
|
||||
layout1.append([step()])
|
||||
|
||||
layout2 = []
|
||||
steps = (self.make_tab2_rows,)
|
||||
layout1_1.append([step()])
|
||||
layout1_2 = []
|
||||
steps = (self.make_tab1_slider_rows,)
|
||||
for step in steps:
|
||||
layout2.append([step()])
|
||||
layout1_2.append([step()])
|
||||
|
||||
layout3 = []
|
||||
steps = (self.make_tab3_rows,)
|
||||
layout2_1 = []
|
||||
steps = (self.make_tab2_button_rows,)
|
||||
for step in steps:
|
||||
layout3.append([step()])
|
||||
layout2_1.append([step()])
|
||||
layout2_2 = []
|
||||
steps = (self.make_tab2_slider_rows,)
|
||||
for step in steps:
|
||||
layout2_2.append([step()])
|
||||
|
||||
layouts = [layout0, layout1, layout2, layout3]
|
||||
layout3_1 = []
|
||||
steps = (self.make_tab3_button_rows,)
|
||||
for step in steps:
|
||||
layout3_1.append([step()])
|
||||
layout3_2 = []
|
||||
steps = (self.make_tab3_slider_rows,)
|
||||
for step in steps:
|
||||
layout3_2.append([step()])
|
||||
|
||||
tabs = [psg.Tab(identifier, layouts[i], key=identifier) for i, identifier in enumerate(get_tabs_labels())]
|
||||
tab_group = psg.TabGroup([tabs], change_submits=True, key="tabs")
|
||||
def _make_inner_tabgroup(layouts, identifier) -> psg.TabGroup:
|
||||
inner_layout = []
|
||||
for i, tabname in enumerate(("buttons", "sliders")):
|
||||
inner_layout.append([psg.Tab(tabname.capitalize(), layouts[i], key=f"tab||{identifier}||{tabname}")])
|
||||
return psg.TabGroup(
|
||||
inner_layout,
|
||||
change_submits=True,
|
||||
enable_events=True,
|
||||
key=f"tabgroup||{identifier}",
|
||||
)
|
||||
|
||||
def _make_tabs(identifier) -> psg.Tab:
|
||||
match identifier:
|
||||
case "Settings":
|
||||
return psg.Tab("Settings", layout0, key="tab||Settings")
|
||||
case "Physical Strip":
|
||||
tabgroup = _make_inner_tabgroup((layout1_1, layout1_2), identifier)
|
||||
case "Virtual Strip":
|
||||
tabgroup = _make_inner_tabgroup((layout2_1, layout2_2), identifier)
|
||||
case "Buses":
|
||||
tabgroup = _make_inner_tabgroup((layout3_1, layout3_2), identifier)
|
||||
return psg.Tab(identifier, [[tabgroup]], key=f"tab||{identifier}")
|
||||
|
||||
tabs = []
|
||||
for tab in util.get_tabs_labels():
|
||||
tabs.append(_make_tabs(tab))
|
||||
|
||||
tab_group = psg.TabGroup([tabs], change_submits=True, enable_events=True, key="tabgroup")
|
||||
|
||||
return [[menu], [tab_group]]
|
||||
|
||||
@@ -80,7 +110,7 @@ class Builder:
|
||||
"""tab0 row0 represents hardware ins"""
|
||||
|
||||
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 -")
|
||||
layout.append(
|
||||
[
|
||||
@@ -94,7 +124,7 @@ class Builder:
|
||||
]
|
||||
)
|
||||
|
||||
hardware_in = list()
|
||||
hardware_in = []
|
||||
[step(hardware_in) for step in (add_physical_device_opts,)]
|
||||
return psg.Frame("Hardware In", hardware_in)
|
||||
|
||||
@@ -102,8 +132,6 @@ class Builder:
|
||||
"""tab0 row1 represents hardware outs"""
|
||||
|
||||
def add_physical_device_opts(layout):
|
||||
devices = get_output_device_list(self.vm)
|
||||
devices.append("- remove device selection -")
|
||||
if self.kind.name == "basic":
|
||||
num_outs = self.kind.phys_out + self.kind.virt_out
|
||||
else:
|
||||
@@ -113,14 +141,14 @@ class Builder:
|
||||
psg.ButtonMenu(
|
||||
f"A{i + 1}",
|
||||
size=(6, 3),
|
||||
menu_def=["", devices],
|
||||
menu_def=["", util.get_output_device_list(i, self.vm)],
|
||||
key=f"HARDWARE OUT||A{i + 1}",
|
||||
)
|
||||
for i in range(num_outs)
|
||||
]
|
||||
)
|
||||
|
||||
hardware_out = list()
|
||||
hardware_out = []
|
||||
[step(hardware_out) for step in (add_physical_device_opts,)]
|
||||
return psg.Frame("Hardware Out", hardware_out)
|
||||
|
||||
@@ -133,7 +161,7 @@ class Builder:
|
||||
[
|
||||
psg.Spin(
|
||||
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,
|
||||
enable_events=True,
|
||||
key=f"ASIO CHECKBOX||IN{i} 0",
|
||||
@@ -144,7 +172,7 @@ class Builder:
|
||||
[
|
||||
psg.Spin(
|
||||
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,
|
||||
enable_events=True,
|
||||
key=f"ASIO CHECKBOX||IN{i} 1",
|
||||
@@ -152,7 +180,7 @@ class Builder:
|
||||
],
|
||||
)
|
||||
|
||||
inner = list()
|
||||
inner = []
|
||||
asio_checkboxlists = ([] for _ in range(self.kind.phys_out))
|
||||
for i, checkbox_list in enumerate(asio_checkboxlists):
|
||||
[step(checkbox_list, i + 1) for step in (add_asio_checkboxes,)]
|
||||
@@ -165,7 +193,7 @@ class Builder:
|
||||
"""tab0 row3 represents patch composite"""
|
||||
|
||||
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(
|
||||
[
|
||||
psg.ButtonMenu(
|
||||
@@ -178,7 +206,7 @@ class Builder:
|
||||
]
|
||||
)
|
||||
|
||||
hardware_out = list()
|
||||
hardware_out = []
|
||||
[step(hardware_out) for step in (add_physical_device_opts,)]
|
||||
return psg.Frame("PATCH COMPOSITE", hardware_out)
|
||||
|
||||
@@ -192,7 +220,9 @@ class Builder:
|
||||
[
|
||||
psg.Checkbox(
|
||||
text=channel,
|
||||
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
|
||||
default=self.window.cache["insert"][
|
||||
f"INSERT CHECKBOX||{util.get_insert_checkbox_index(self.kind, j, i)}"
|
||||
],
|
||||
enable_events=True,
|
||||
key=f"INSERT CHECKBOX||IN{i} {j}",
|
||||
)
|
||||
@@ -205,7 +235,9 @@ class Builder:
|
||||
[
|
||||
psg.Checkbox(
|
||||
text=channel,
|
||||
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
|
||||
default=self.window.cache["insert"][
|
||||
f"INSERT CHECKBOX||{util.get_insert_checkbox_index(self.kind, j, i)}"
|
||||
],
|
||||
enable_events=True,
|
||||
key=f"INSERT CHECKBOX||IN{i} {j}",
|
||||
)
|
||||
@@ -213,8 +245,8 @@ class Builder:
|
||||
],
|
||||
)
|
||||
|
||||
asio_checkboxes = list()
|
||||
inner = list()
|
||||
asio_checkboxes = []
|
||||
inner = []
|
||||
checkbox_lists = ([] for _ in range(self.kind.num_strip))
|
||||
for i, checkbox_list in enumerate(checkbox_lists):
|
||||
if i < self.kind.phys_in:
|
||||
@@ -228,27 +260,23 @@ class Builder:
|
||||
return psg.Frame("PATCH INSERT", asio_checkboxes)
|
||||
|
||||
def make_tab0_row5(self) -> psg.Frame:
|
||||
"""tab0 row5 represents asio buffer"""
|
||||
|
||||
samples = get_asio_samples_list()
|
||||
samples.append("Default")
|
||||
"""tab0 row5 represents advanced settings"""
|
||||
|
||||
return psg.Frame(
|
||||
"ASIO BUFFER",
|
||||
"ADVANCED SETTINGS",
|
||||
[
|
||||
[
|
||||
psg.ButtonMenu(
|
||||
"ASIO BUFFER",
|
||||
size=(14, 2),
|
||||
menu_def=["", samples],
|
||||
key="ASIO BUFFER",
|
||||
psg.Button(
|
||||
"ADVANCED SETTINGS",
|
||||
size=(20, 2),
|
||||
key="ADVANCED SETTINGS",
|
||||
)
|
||||
]
|
||||
],
|
||||
key="ASIO BUFFER FRAME",
|
||||
],
|
||||
key="ADVANCED SETTINGS FRAME",
|
||||
)
|
||||
|
||||
def make_tab1_row(self, i) -> psg.Frame:
|
||||
def make_tab1_button_row(self, i) -> psg.Frame:
|
||||
"""tab1 row represents a strip's outputs (A1-A5, B1-B3)"""
|
||||
|
||||
def add_strip_outputs(layout):
|
||||
@@ -272,15 +300,64 @@ class Builder:
|
||||
],
|
||||
)
|
||||
|
||||
outputs = list()
|
||||
outputs = []
|
||||
[step(outputs) for step in (add_strip_outputs,)]
|
||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL")
|
||||
|
||||
def make_tab1_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab1_row(i)] for i in range(self.kind.phys_in)]
|
||||
def make_tab1_button_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab1_button_row(i)] for i in range(self.kind.phys_in)]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
def make_tab2_row(self, i) -> psg.Frame:
|
||||
def make_tab1_slider_row(self, i) -> psg.Frame:
|
||||
def add_gain_slider(layout):
|
||||
layout.append(
|
||||
[
|
||||
psg.Text("Gain"),
|
||||
psg.Slider(
|
||||
range=(-60, 12),
|
||||
default_value=self.vm.strip[i].gain,
|
||||
resolution=0.1,
|
||||
disable_number_display=True,
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"STRIP {i}||SLIDER GAIN",
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
def add_param_sliders(layout):
|
||||
layout.append([LabelSlider(self.window, i, param) for param in util.get_slider_params(i, self.kind)])
|
||||
|
||||
def add_limit_slider(layout):
|
||||
layout.append(
|
||||
[
|
||||
psg.Text("Limit"),
|
||||
psg.Slider(
|
||||
range=(-40, 12),
|
||||
default_value=self.vm.strip[i].limit,
|
||||
resolution=1,
|
||||
disable_number_display=True,
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"STRIP {i}||SLIDER LIMIT",
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
layout = []
|
||||
steps = (add_gain_slider, add_param_sliders)
|
||||
if self.kind.name in ("banana", "potato"):
|
||||
steps += (add_limit_slider,)
|
||||
[step(layout) for step in steps]
|
||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], layout, key=f"STRIP {i}||LABEL||SLIDER")
|
||||
|
||||
def make_tab1_slider_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab1_slider_row(i)] for i in range(self.kind.phys_in)]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
def make_tab2_button_row(self, i) -> psg.Frame:
|
||||
"""tab2 row represents a strip's outputs (A1-A5, B1-B3)"""
|
||||
|
||||
def add_strip_outputs(layout):
|
||||
@@ -313,15 +390,77 @@ class Builder:
|
||||
],
|
||||
)
|
||||
|
||||
outputs = list()
|
||||
outputs = []
|
||||
[step(outputs) for step in (add_strip_outputs,)]
|
||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL")
|
||||
|
||||
def make_tab2_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab2_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)]
|
||||
def make_tab2_button_rows(self) -> psg.Frame:
|
||||
layout = [
|
||||
[self.make_tab2_button_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)
|
||||
]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
def make_tab3_row(self, i) -> psg.Frame:
|
||||
def make_tab2_slider_row(self, i) -> psg.Frame:
|
||||
def add_gain_slider(layout):
|
||||
layout.append(
|
||||
[
|
||||
psg.Text("Gain"),
|
||||
psg.Slider(
|
||||
range=(-60, 12),
|
||||
default_value=self.vm.strip[i].gain,
|
||||
resolution=0.1,
|
||||
disable_number_display=True,
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"STRIP {i}||SLIDER GAIN",
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
def add_param_sliders(layout):
|
||||
if self.kind.name in ("basic", "banana"):
|
||||
for param in util.get_slider_params(i, self.kind):
|
||||
layout.append([LabelSlider(self.window, i, param, range_=(-12, 12))])
|
||||
else:
|
||||
layout.append(
|
||||
[
|
||||
LabelSlider(self.window, i, param, range_=(-12, 12))
|
||||
for param in util.get_slider_params(i, self.kind)
|
||||
]
|
||||
)
|
||||
|
||||
def add_limit_slider(layout):
|
||||
layout.append(
|
||||
[
|
||||
psg.Text("Limit"),
|
||||
psg.Slider(
|
||||
range=(-40, 12),
|
||||
default_value=self.vm.strip[i].limit,
|
||||
resolution=1,
|
||||
disable_number_display=True,
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"STRIP {i}||SLIDER LIMIT",
|
||||
),
|
||||
]
|
||||
)
|
||||
|
||||
layout = []
|
||||
steps = (add_gain_slider, add_param_sliders)
|
||||
if self.kind.name in ("banana", "potato"):
|
||||
steps += (add_limit_slider,)
|
||||
[step(layout) for step in steps]
|
||||
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], layout, key=f"STRIP {i}||LABEL||SLIDER")
|
||||
|
||||
def make_tab2_slider_rows(self) -> psg.Frame:
|
||||
layout = [
|
||||
[self.make_tab2_slider_row(i)] for i in range(self.kind.phys_in, self.kind.phys_in + self.kind.virt_in)
|
||||
]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
def make_tab3_button_row(self, i) -> psg.Frame:
|
||||
"""tab3 row represents bus composite toggle"""
|
||||
|
||||
def add_strip_outputs(layout):
|
||||
@@ -340,10 +479,35 @@ class Builder:
|
||||
]
|
||||
)
|
||||
|
||||
outputs = list()
|
||||
outputs = []
|
||||
[step(outputs) for step in (add_strip_outputs,)]
|
||||
return psg.Frame(self.window.cache["labels"][f"BUS {i}||LABEL"], outputs, key=f"BUS {i}||LABEL")
|
||||
|
||||
def make_tab3_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab3_row(i)] for i in range(self.kind.num_bus)]
|
||||
def make_tab3_button_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab3_button_row(i)] for i in range(self.kind.num_bus)]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
def make_tab3_slider_row(self, i) -> psg.Frame:
|
||||
def add_gain_slider(layout):
|
||||
layout.append(
|
||||
[
|
||||
psg.Slider(
|
||||
range=(-60, 12),
|
||||
default_value=self.vm.bus[i].gain,
|
||||
resolution=0.1,
|
||||
disable_number_display=True,
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"BUS {i}||SLIDER GAIN",
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
outputs = []
|
||||
[step(outputs) for step in (add_gain_slider,)]
|
||||
return psg.Frame(self.window.cache["labels"][f"BUS {i}||LABEL"], outputs, key=f"BUS {i}||LABEL||SLIDER")
|
||||
|
||||
def make_tab3_slider_rows(self) -> psg.Frame:
|
||||
layout = [[self.make_tab3_slider_row(i)] for i in range(self.kind.num_bus)]
|
||||
return psg.Frame(None, layout, border_width=0)
|
||||
|
||||
35
src/nvda_voicemeeter/compound.py
Normal file
35
src/nvda_voicemeeter/compound.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import PySimpleGUI as psg
|
||||
|
||||
|
||||
class LabelSlider(psg.Frame):
|
||||
"""Compound Label Slider element"""
|
||||
|
||||
def __init__(self, parent, i, param, range_=(0, 10), *args, **kwargs):
|
||||
self.parent = parent
|
||||
if param in ("AUDIBILITY", "DENOISER"):
|
||||
size = 7
|
||||
else:
|
||||
size = 4
|
||||
layout = [
|
||||
[
|
||||
psg.Text(param.capitalize(), size=size),
|
||||
psg.Slider(
|
||||
range=range_,
|
||||
default_value=self.default_value(i, param),
|
||||
resolution=0.1,
|
||||
disable_number_display=True,
|
||||
size=(12, 16),
|
||||
expand_x=True,
|
||||
enable_events=True,
|
||||
orientation="horizontal",
|
||||
key=f"STRIP {i}||SLIDER {param}",
|
||||
),
|
||||
]
|
||||
]
|
||||
super().__init__(None, layout=layout, border_width=0, pad=0, *args, **kwargs)
|
||||
|
||||
def default_value(self, i, param):
|
||||
target = getattr(self.parent.vm.strip[i], param.lower())
|
||||
if param in ("COMP", "GATE", "DENOISER"):
|
||||
return target.knob
|
||||
return target
|
||||
@@ -42,14 +42,14 @@ def _make_param_cache(vm, channel_type) -> dict:
|
||||
**{f"STRIP {i}||SOLO": vm.strip[i].solo for i in range(vm.kind.num_strip)},
|
||||
**{f"STRIP {i}||MUTE": vm.strip[i].mute for i in range(vm.kind.num_strip)},
|
||||
}
|
||||
return params
|
||||
else:
|
||||
return {
|
||||
params |= {
|
||||
**{f"BUS {i}||MONO": vm.bus[i].mono for i in range(vm.kind.num_bus)},
|
||||
**{f"BUS {i}||EQ": vm.bus[i].eq.on for i in range(vm.kind.num_bus)},
|
||||
**{f"BUS {i}||MUTE": vm.bus[i].mute for i in range(vm.kind.num_bus)},
|
||||
**{f"BUS {i}||MODE": vm.bus[i].mode.get() for i in range(vm.kind.num_bus)},
|
||||
}
|
||||
return params
|
||||
|
||||
|
||||
def _make_label_cache(vm) -> dict:
|
||||
|
||||
157
src/nvda_voicemeeter/popup.py
Normal file
157
src/nvda_voicemeeter/popup.py
Normal file
@@ -0,0 +1,157 @@
|
||||
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.kind = self.window.kind
|
||||
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, index, title=None, tab=None):
|
||||
if "Strip" in tab:
|
||||
if index < self.kind.phys_in:
|
||||
title += f" Physical Strip {index + 1}"
|
||||
else:
|
||||
title += f" Virtual Strip {index - self.kind.phys_in + 1}"
|
||||
else:
|
||||
if index < self.kind.phys_out:
|
||||
title += f" Physical Bus {index + 1}"
|
||||
else:
|
||||
title += f" Virtual Bus {index - self.kind.phys_out + 1}"
|
||||
layout = [
|
||||
[psg.Text(message)],
|
||||
[
|
||||
[
|
||||
psg.Input(key="Edit"),
|
||||
],
|
||||
[psg.Button("Ok"), psg.Button("Cancel")],
|
||||
],
|
||||
]
|
||||
popup = psg.Window(title, layout, finalize=True)
|
||||
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 [[button], ["FOCUS", "IN"]]:
|
||||
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()
|
||||
@@ -1,3 +1,6 @@
|
||||
from typing import Iterable
|
||||
|
||||
|
||||
def get_asio_checkbox_index(channel, num) -> int:
|
||||
if channel == 0:
|
||||
return 2 * num - 2
|
||||
@@ -8,17 +11,36 @@ def get_insert_checkbox_index(kind, channel, num) -> int:
|
||||
if num <= kind.phys_in:
|
||||
if channel == 0:
|
||||
return 2 * num - 2
|
||||
else:
|
||||
return 2 * num - 1
|
||||
return (2 * kind.phys_in) + (8 * (num - kind.phys_in - 1)) + channel
|
||||
|
||||
|
||||
_rejected_ids = (
|
||||
"VBAudio100VMVAIO3",
|
||||
"{F5735BD4-6EAF-4758-9710-9886E5AD0FF3}",
|
||||
"{0239BE07-CEEF-4236-A900-AA778D432FD4}",
|
||||
)
|
||||
|
||||
|
||||
def get_input_device_list(vm) -> list:
|
||||
return ["{type}: {name}".format(**vm.device.input(i)) for i in range(vm.device.ins)]
|
||||
devices = []
|
||||
for j in range(vm.device.ins):
|
||||
device = vm.device.input(j)
|
||||
if device["id"] not in _rejected_ids:
|
||||
devices.append("{type}: {name}".format(**device))
|
||||
return devices
|
||||
|
||||
|
||||
def get_output_device_list(vm) -> list:
|
||||
return ["{type}: {name}".format(**vm.device.output(i)) for i in range(vm.device.outs)]
|
||||
def get_output_device_list(i, vm) -> list:
|
||||
devices = []
|
||||
for j in range(vm.device.outs):
|
||||
device = vm.device.output(j)
|
||||
if device["id"] not in _rejected_ids:
|
||||
devices.append("{type}: {name}".format(**device))
|
||||
if i == 0:
|
||||
return devices
|
||||
devices.append("- remove device selection -")
|
||||
return [device for device in devices if not device.startswith("asio")]
|
||||
|
||||
|
||||
def get_patch_composite_list(kind) -> list:
|
||||
@@ -47,28 +69,20 @@ def get_patch_insert_channels() -> list:
|
||||
_patch_insert_channels = get_patch_insert_channels()
|
||||
|
||||
|
||||
def get_asio_samples_list() -> list:
|
||||
return [
|
||||
"1024",
|
||||
"768",
|
||||
"704",
|
||||
"640",
|
||||
"576",
|
||||
"512",
|
||||
"480",
|
||||
"448",
|
||||
"441",
|
||||
"416",
|
||||
"384",
|
||||
"352",
|
||||
"320",
|
||||
"288",
|
||||
"256",
|
||||
"224",
|
||||
"192",
|
||||
"160",
|
||||
"128",
|
||||
def get_asio_samples_list(driver) -> list:
|
||||
if driver == "MME":
|
||||
samples = ["2048", "1536", "1024", "896", "768", "704", "640", "576", "512", "480", "441"]
|
||||
else:
|
||||
# fmt: off
|
||||
samples = [
|
||||
"2048", "1536", "1024", "768", "704", "640", "576", "512", "480", "448", "441", "416", "384",
|
||||
"352", "320", "288", "256", "224", "192", "160", "128"
|
||||
]
|
||||
# fmt: on
|
||||
if driver == "ASIO":
|
||||
samples = [x for x in samples if x not in ("2048", "1536")]
|
||||
samples.append("Default")
|
||||
return samples
|
||||
|
||||
|
||||
def get_tabs_labels() -> list:
|
||||
@@ -116,3 +130,30 @@ def get_bus_modes(vm) -> list:
|
||||
"lfeonly",
|
||||
"rearonly",
|
||||
]
|
||||
|
||||
|
||||
def check_bounds(val, bounds: tuple) -> int | float:
|
||||
lower, upper = bounds
|
||||
if val > upper:
|
||||
val = upper
|
||||
elif val < lower:
|
||||
val = lower
|
||||
return val
|
||||
|
||||
|
||||
def get_slider_params(i, kind) -> Iterable:
|
||||
if i < kind.phys_in:
|
||||
if kind.name == "basic":
|
||||
return ("AUDIBILITY",)
|
||||
if kind.name == "banana":
|
||||
return ("COMP", "GATE")
|
||||
if kind.name == "potato":
|
||||
return ("COMP", "GATE", "DENOISER")
|
||||
return ("BASS", "MID", "TREBLE")
|
||||
|
||||
|
||||
def get_full_slider_params(i, kind) -> Iterable:
|
||||
params = list(get_slider_params(i, kind) + ("GAIN", "LIMIT"))
|
||||
if kind.name == "basic":
|
||||
params.remove("LIMIT")
|
||||
return params
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user