Compare commits

..

170 Commits

Author SHA1 Message Date
bde9020471 closes #17 2023-10-29 19:26:03 +00:00
364b0deeb4 bump to v0.5.6b1
addresses issue #17
2023-10-26 21:06:06 +01:00
a80e4e2d83 Patch BUS to A1 ASIO Outputs implemented
Patch ASIO Inputs to Strips moved to Advanced Settings
2023-10-26 20:12:49 +01:00
6e146bac50 upd images 2023-10-04 05:22:08 +01:00
c385476cc4 adjust cache to match strip layout
event keys updated

_get_bus_assignments added to util.py

patch bump
2023-09-29 20:08:18 +01:00
1c09556c61 adds missing karaoke mode k v
patch bump
2023-09-29 18:30:53 +01:00
421688eff8 resizes the patch composite buttons
fixes possible (but unlikely) index out of range.

patch bump
2023-09-29 13:38:40 +01:00
bdd570738a fix version bump... 2023-09-29 01:18:57 +01:00
71b137a9c2 use self.kind 2023-09-29 01:16:48 +01:00
912eb8c14d number of patch composite buttons fixed
for banana and potato kinds

voicemeeter-api dependency bump

patch bump
2023-09-29 01:09:18 +01:00
9cd65737e5 bump to version 0.5.1
closes #16
2023-09-28 23:35:02 +01:00
4a6ca2a353 check against slider modes explicitly
add enter/exit slider mode debug logging
2023-09-28 22:43:06 +01:00
cc99b14e89 define space bind event for bus buttons 2023-09-28 21:35:05 +01:00
23458debaa initial busmode buttonmenu implementation
bump to 0.5.1a1
Issue #16
2023-09-28 19:44:42 +01:00
496cc35321 fixes comp output gain resolution 2023-09-28 18:18:26 +01:00
d758db9dee lint/format fixes 2023-09-28 16:32:52 +01:00
876de55ad2 Advanced Comp|Gate sliders implemented
bump to 0.5.0

closes #14
2023-09-27 23:34:07 +01:00
eab4b1c6a9 fixes unboundlocalerror 2023-09-27 13:36:48 +01:00
0aeb33608f implements reset binds
Advanced Comp|Gate section added to README.

bump to version 0.5.0b1
2023-09-26 23:51:34 +01:00
5befe72ca1 adds pdirty events for advanced comp/gate 2023-09-26 19:38:55 +01:00
abab560281 +10, +50 step binds added for gate
bump to version 0.5.0a2
Initial gate slider implementation
for Issue #14
2023-09-26 17:20:15 +01:00
6882adb47b gate as no Knee parameter 2023-09-26 15:56:12 +01:00
af602e087d GateSlider added to compound
Advanced Gate slider layout and events defined
needs more testing.
2023-09-26 15:53:43 +01:00
01e80dc4f6 replace flake8 with ruff
add tool.ruff to pyproject

update lint dependencies

removes settings.json

ruff badge added to readme

bump to version 0.4.2.a1
Initial compressor slider implementation
for Issue #14
2023-09-26 14:37:41 +01:00
7262af4bcf disable default keyboard/mouse events
for gain sliders
2023-09-26 13:33:13 +01:00
ef10b224d7 remove redundant if statement 2023-09-25 18:24:43 +01:00
89d0253591 add advanced comproessor slider events
voicemeeter-api version bumped

some of the spoken feedback for sliders corrected.
2023-09-25 18:22:17 +01:00
85527e0749 defines layout for compressor popup 2023-09-25 12:14:29 +01:00
9d8ea5f747 fixes regression, bus focus in/out readded
patch bump
2023-09-23 17:04:33 +01:00
0dd6c89f96 implements up/down slider mode binds
adjustments to pdirty event toggling.

press/release events defined for slider binds

note:
the main window no longer returns keyboard events

minor bump
2023-09-23 16:36:48 +01:00
893f9f59ff patch asio spinboxes set as readonly
patch insert checkboxes enter bind added
2023-09-21 16:39:21 +01:00
3ca9e14e96 adds bass, mid and treble slider modes
patch bump
2023-09-21 09:33:22 +01:00
4ca64f94bc re 2023-09-21 08:35:55 +01:00
22bf109499 removes the spinbox from the rename popup
updates README

fixes #12

b1 bump
2023-09-20 18:24:24 +01:00
a19aab3936 closes #10
minor bump
2023-09-20 16:58:33 +01:00
7134b6d209 adds alt + number in quick binds to readme 2023-09-20 16:51:40 +01:00
1525710d31 upd readme image 2023-09-20 16:29:52 +01:00
2745e2c41a refactor slider mode binds 2023-09-20 16:29:42 +01:00
8716149eda fixes attribute error 2023-09-20 13:07:04 +01:00
dde940938f sync not required. using callbacks. 2023-09-20 11:34:06 +01:00
09f052b4a3 defines slider mode nav events 2023-09-20 10:40:09 +01:00
577f1fbdbb fixes limit resolution 2023-09-20 10:38:30 +01:00
f9614f44ac popups moved into popup.py 2023-09-20 10:01:48 +01:00
9b757b743b shortens the spoken feedback
for most of the controls.

needs more testing...
2023-09-19 23:19:39 +01:00
7f8f6f2b6c adds more navigation binds.
adds slider modes.
2023-09-19 22:22:44 +01:00
0c806b8e4c add guard clauses for nav binds 2023-09-18 23:07:09 +01:00
645361c731 bump to pre-release a1 2023-09-18 09:38:37 +01:00
6baa0000c8 Merge remote-tracking branch 'origin/dev' into add-nav-binds 2023-09-18 09:18:44 +01:00
d722154325 adds ctrl+shift+r slider reset bind
closes #9

patch bump
2023-09-18 09:12:12 +01:00
c94d763569 adds some quick navigation binds 2023-09-18 00:07:35 +01:00
ac14b7ad0d adds sliders to on_pdirty
bump to b2
2023-09-17 14:49:42 +01:00
78b7e01fa6 bump to 0.2.1.b1 2023-09-17 12:36:15 +01:00
42fad86905 defines bass,mid,treble ctrl events 2023-09-17 12:23:04 +01:00
6c54d28210 define focus out for bass,mid,treble 2023-09-17 12:09:38 +01:00
d958167ded fixes comp, gate, denoiser ctrl+up/down/left/right 2023-09-17 12:07:14 +01:00
0570138963 bass, mid, treble slider events defined 2023-09-17 11:44:15 +01:00
1fdb39a041 events defined for sliders
resolution fix for limit slider
2023-09-17 11:25:11 +01:00
3d7b33c8be fix events for sliders 2023-09-17 10:18:22 +01:00
cf5c8f81aa bind events added for sliders 2023-09-17 09:30:38 +01:00
c248808c7b LabelSlider compound element added
labels for sliders added.

all sliders now focusable.

todo: add events/binds for sliders
2023-09-16 23:13:56 +01:00
d93f078365 upd type annotations
cleanup global namespace.
2023-09-16 20:28:07 +01:00
e0f36b2411 start laying out parameter sliders. 2023-09-16 10:45:56 +01:00
719328c6de adds check bounds.
bump pre-release a3
2023-09-15 23:01:26 +01:00
65a148aa7b bump to pre-release a2 2023-09-15 19:16:30 +01:00
ba1fb28187 use gain getters. 2023-09-15 19:12:07 +01:00
e35bad9e1e a1 version bump 2023-09-15 13:48:19 +01:00
804af85e65 adds up,down bind events 2023-09-15 12:35:10 +01:00
96de917b64 gain slider control events registered
allows adjusting gain by different amounts.
2023-09-15 11:35:27 +01:00
bc14116cd7 places gain sliders on slider tabs
slider focus in/out events registered.
2023-09-15 10:55:22 +01:00
086fbc1b8c start laying out nested tab structure
focus in events added for tabgroups

focus the settings tab on startup
2023-09-14 13:46:26 +01:00
047577265c documentation changes
python version upper limit increased to support 3.11
2023-09-14 08:43:15 +01:00
7ab7c30e80 adds advanced settings for Basic kind. 2023-09-13 14:12:48 +01:00
bfdc0306e3 update default values for each driver type
open advanced settings popup if current tab is settings.

minor version bump
2023-09-13 12:16:28 +01:00
245476adfd Merge remote-tracking branch 'origin/dev' into add-advanced-settings 2023-09-13 11:30:00 +01:00
2562c02b7e lstrip hardware in as well. 2023-09-13 10:59:41 +01:00
aaa2c72668 fixes bug setting devices with trailing spaces
adds rejected_ids to util.
removes Voicemeeter devices as assignable
hardware devices

patch bump
2023-09-13 10:56:09 +01:00
7648b68b85 remove asio devices from hardware out context menus
if not A1

removes `-remove device selection-` from hardware out A1 context menu

patch bump

fixes #7
2023-09-11 12:36:40 +01:00
14c6b937d1 implements advanced settings popup
gives access to driver buffer settings.

may open by button or ctrl-a
2023-09-11 07:51:16 +01:00
5069db97da ensure Virtual Input gets correct label if cleared 2023-09-10 14:32:31 +01:00
681bf8e85c fixes bug renaming virtual strips.
patch bump
2023-09-10 14:23:34 +01:00
8424558f3d special thanks section added to readme 2023-09-07 07:29:04 +01:00
39bd5f21ea patch bump
fixes #3
2023-09-06 19:19:54 +01:00
77dfd00541 reduces the bus mode list for basic kind 2023-09-06 19:18:31 +01:00
790ac10d4a remove EQ button and events if kind is basic 2023-09-06 19:18:14 +01:00
ed5f9ae45b fixes hardware out A2 for basic kind.
patch bump
2023-09-06 16:20:04 +01:00
962b61f60a fixes k, mc layout for banana kind 2023-09-06 15:27:55 +01:00
b2e03aace1 add settings tab screenshot
Installation section added to readme
2023-09-06 15:07:59 +01:00
3a52655811 add Voicemeeter link 2023-09-06 05:29:23 +01:00
178d6e451b add screenshots 2023-09-06 00:58:09 +01:00
fc8ae11555 add badges 2023-09-06 00:42:49 +01:00
e4afe35fb2 initial README 2023-09-06 00:33:59 +01:00
e2edd29b87 hardware ins implemented
strip, bus params implemented
(mute, mono, eq etc)

bus mode buttons now rotate through all bus modes
2023-09-06 00:03:12 +01:00
5995ecbb4a hardware outs cache implemented 2023-09-05 16:10:54 +01:00
749406afec refactor focus in events for rename popup 2023-09-05 06:19:52 +01:00
da77e1bba1 error log for debug log 2023-09-05 05:43:38 +01:00
8aec9a4302 use get_channel_identifier_list
for asio checkboxes
2023-09-05 05:35:38 +01:00
abdab7403a parameter updates implemented.
More testing required.
2023-09-05 05:30:46 +01:00
5d8eda4976 remove logging from example main.py 2023-09-05 05:28:41 +01:00
5cd4342b47 adds enter bind for BUSMODE buttons 2023-09-04 07:40:14 +01:00
5cc8f1ae3d write default_config to json file 2023-09-04 05:11:45 +01:00
7357cacc30 fixes bug when pressing F2 on settings tab 2023-09-02 05:00:38 +01:00
084177ea2d remove print statement 2023-09-02 04:51:17 +01:00
b3771b13c0 add debug logs for popups 2023-09-02 04:49:36 +01:00
2666d8081a implements label cache
popup_rename implemented

button binds added.
2023-09-02 04:23:15 +01:00
7ff9c9e33b implements default labels 2023-09-02 02:47:27 +01:00
4f4a577af9 removed popup for file browse
now it opens the file browser directly

popup_save_as reworked.
input box removed.
return binds for browse,cancel added
2023-09-01 23:20:36 +01:00
401887de46 file browsers now open for all config menu items
check if file from pickle file exists, before loading
2023-09-01 10:43:37 +01:00
9b49d97676 custom popup windows implemented
buttons now have bind events
2023-09-01 05:57:22 +01:00
50d2fa3de8 save,load and load on startup implemented 2023-09-01 03:04:39 +01:00
2de1b379f5 removes ok_exp 2023-08-29 10:47:09 +01:00
a04b7c5fcf no longer need to track focus 2023-08-29 02:58:13 +01:00
786b2658d9 swap COMPOSITE for BUSMODE 2023-08-28 21:21:26 +01:00
417a35764b implements reopenable context menus
adds <return> event for buttons
2023-08-28 20:27:06 +01:00
7b0f3d782a remove unused import 2023-08-28 13:23:14 +01:00
fba48995c9 remove 'next_tab' 2023-08-28 12:25:55 +01:00
6e261eedb1 add psgdemos to test dependencies 2023-08-28 12:11:48 +01:00
0bf333d23d implements focus tab group on
ctrl+tab and ctrl+shift+tab
2023-08-28 12:11:34 +01:00
c1fe70c387 pass only KIND_ID to draw() 2023-08-28 03:25:39 +01:00
a0c854d53f add lint dependencies 2023-08-27 21:03:36 +01:00
c12ef8f146 update docstrings in builder.py 2023-08-27 21:03:28 +01:00
d09a96b887 fetches asio buffer value on focus 2023-08-26 22:06:58 +01:00
2847762aa1 nvda speak asio buffer value after setting 2023-08-26 21:59:48 +01:00
a1c7f1358e implements asio buffer 2023-08-26 21:55:39 +01:00
e1fb16c32b implements:
buses tab
composite buttons
bus composite events
2023-08-26 20:22:46 +01:00
ddbb339810 remove debug statement 2023-08-26 19:48:02 +01:00
10e99c5f78 adds a single menu to restart audio engine
keep track of focus, fixes bug when exiting contex menu
2023-08-26 19:46:39 +01:00
84e349f943 fixes regressoin in event bindings 2023-08-26 17:29:24 +01:00
4ebab80a19 app now loads properly for kind basic 2023-08-26 10:42:18 +01:00
92b0772df8 build script added to pdm scripts 2023-08-26 09:43:33 +01:00
66171e03a9 pring values debug in its own statement 2023-08-26 09:39:51 +01:00
9d847cf01d strip outputs focus in event reads label if set 2023-08-26 09:07:02 +01:00
2354cc4501 implements strip output events 2023-08-26 00:11:05 +01:00
9adbf71494 implements focus in event for tabgroup 2023-08-25 22:53:48 +01:00
7d89b0c4ae implements notification on tab switch 2023-08-25 22:33:28 +01:00
fafe9ea4d6 implements tabs physical strip, virtual strip
output buttons are laid out and events are defined
2023-08-25 22:25:30 +01:00
2490fc9343 increment indices in formatted strings
instead of range expressions
2023-08-25 20:41:48 +01:00
ead28db48c check only ok_exp 2023-08-25 20:36:04 +01:00
7d3647afd7 implements events for patch composite 2023-08-25 20:23:21 +01:00
c308a8fd07 query values dict
instead of making redundant api calls
2023-08-25 18:52:26 +01:00
e4e372e84a rename builder methods to denote tab and row 2023-08-25 18:50:29 +01:00
b98f892b23 implements a basic tab structure
using tabgroup ("settings", "physical", "virtual")

Patch Composite buttons placed.
Events for patch composite not yet implemented
2023-08-25 18:29:43 +01:00
c74e4c40c2 change default theme
don't load button cache by default
2023-08-25 02:19:01 +01:00
74e6aa5f0c refactor event bindings 2023-08-24 18:02:53 +01:00
aecc9efb83 refactor make_row2 2023-08-24 17:22:37 +01:00
7d02921626 sync the getters for now
(todo: implement parameter callbacks)
2023-08-24 16:54:44 +01:00
426e91f6fe implements hardware out as:
focusable buttonmenus.
2023-08-24 16:07:28 +01:00
b45e85badd fixes search path for binary 2023-08-23 19:47:59 +01:00
b6b4c5fd97 move $target out of loop
-Force compress archive if it exists
2023-08-23 16:43:00 +01:00
3f696d86da build and compress 2023-08-23 16:39:50 +01:00
4f48b0f01d add a configurable delay before launching nvda 2023-08-23 16:13:33 +01:00
bf66a1d070 implement launch() function.
Allows launching nvda program at start.
2023-08-23 16:11:32 +01:00
d39cc35e79 add guard clause for empty entry 2023-08-23 03:03:21 +01:00
599b140079 kind_id contant 2023-08-23 02:39:07 +01:00
752f93a64c only register patch events if not kind basic
add basic build script
2023-08-23 02:31:15 +01:00
d9997e1091 upd gitignore 2023-08-23 02:11:48 +01:00
0db0511dc9 implements a text search for comboboxes 2023-08-23 02:04:18 +01:00
cda5e0379b pyinstaller added as development dependency 2023-08-23 00:28:11 +01:00
19f72dd255 fetches correct path if using compiled binary 2023-08-23 00:27:53 +01:00
d195c1cd97 utility methods and default values implemented 2023-08-23 00:27:37 +01:00
c0c0701ed8 using utility index methods 2023-08-23 00:27:12 +01:00
990aea2b42 utility methods that fetch index numbers 2023-08-23 00:26:40 +01:00
9621232a17 implements INSERT CHECKBOX events 2023-08-22 20:41:44 +01:00
6896358071 register events for INSERT CHECKBOX 2023-08-22 18:13:26 +01:00
d6f991ef67 implements make_row2() 2023-08-22 18:13:15 +01:00
5554286ee9 fix passing kind_id to voicemeeterlib 2023-08-22 18:10:10 +01:00
654a86b2ab move layout construction into builder class
separates construction from app representation
2023-08-22 16:11:24 +01:00
a2af0e704c define exception hierarchy
allow is_running to return values x>=0
2023-08-22 16:11:00 +01:00
740cf1ac02 add deselect device to hardware outs 2023-08-22 05:37:06 +01:00
65cd21203b implements asio checkboxes 2023-08-22 05:16:43 +01:00
1fd181d097 events registered for hardware out
hardware out now sets a physical device

nvida speech added
2023-08-22 02:52:03 +01:00
26 changed files with 3535 additions and 87 deletions

15
.gitignore vendored
View File

@@ -161,4 +161,17 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
controllerClient/ # nvda files
controllerClient/*
!.gitkeep
# build files
basic.py
banana.py
potato.py
# persistent storage
settings.json
# quick test
quick.py

View File

@@ -1,5 +0,0 @@
{
"black-formatter.args": [
"--line-length=120"
]
}

192
README.md
View File

@@ -1 +1,191 @@
# example-package [![pdm-managed](https://img.shields.io/badge/pdm-managed-blueviolet)](https://pdm.fming.dev)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
# NVDA Voicemeeter
A remote control app for [Voicemeeter][voicemeeter], designed to be used with the [NVDA screen reader][nvda].
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">
## Requirements
- [NVDA screen reader][nvda]
- [NVDA's Controller Client files][controller_client]
- Python 3.10 or greater
### Installation
#### `From Source`
First clone the source files from this repository and install the dependencies.
```
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/`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├── `x64/`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├── nvdaControllerClient64.dll
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├── `x86/`
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;├── 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.
### Run
Once the repository is downloaded and the controller client files in place you can launch the GUI with the following `__main__.py`:
```python
import voicemeeterlib
import nvda_voicemeeter
KIND_ID = "potato"
with voicemeeterlib.api(KIND_ID) as vm:
with nvda_voicemeeter.draw(KIND_ID, vm) as window:
window.run()
```
### KIND_ID
May be one of the following:
- `basic`
- `banana`
- `potato`
### Use
#### `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 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 reset a slider back to its default value you may use `Control + Shift + R`.
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.
#### `Advanced Compressor|Gate`
For potato version only, you may access advanced Compressor and Gate sliders. Simply focus any Gate or Compressor slider and press `Control + A`. This will open a popup window where you can navigate between the different sliders with `TAB`. Move the sliders with the same binds you would for normal sliders. However, there are a couple of extra binds for certain controls.
For Compressor Release you may use:
- `Alt + Left|Right arrow` to move the slider by 10 steps.
- `Alt + Control + Left|Right arrow` to move the slider by 50 steps.
For Gate BP Sidechain, Attack, Hold, Release you may use:
- `Alt + Left|Right arrow` to move the slider by 10 steps.
- `Alt + Control + Left|Right arrow` to move the slider by 50 steps.
To reset a slider back to its default value you may use `Control + Shift + R`.
#### `Menu`
A single menu item `Voicemeeter` can be opened using `Alt` and then `v`. The menu allows you to:
- Restart Voicemeeter audio engine
- Save/Load current settings (as an xml file)
- Set a config to load automatically on app startup.
The `Save Settings` option opens a popup window with two buttons, `Browse` and `Cancel`. Browse opens a Save As dialog, Cancel returns to the main app window.
`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
[releases]: https://github.com/onyx-and-iris/nvda-voicemeeter/releases

30
SPECIFICATION.md Normal file
View 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.

View File

@@ -2,8 +2,8 @@ import voicemeeterlib
import nvda_voicemeeter import nvda_voicemeeter
kind_id = "potato" KIND_ID = "potato"
with voicemeeterlib.api("potato") as vm: with voicemeeterlib.api(KIND_ID) as vm:
with nvda_voicemeeter.build(f"Voicemeeter {kind_id.capitalize()} NVDA", vm) as window: with nvda_voicemeeter.draw(KIND_ID, vm) as window:
window.run() window.run()

20
build.ps1 Normal file
View File

@@ -0,0 +1,20 @@
function Compress-Builds {
$target = Join-Path -Path $PSScriptRoot -ChildPath "dist"
@("basic", "banana", "potato") | ForEach-Object {
Compress-Archive -Path $(Join-Path -Path $target -ChildPath $_) -DestinationPath $(Join-Path -Path $target -ChildPath "${_}.zip") -Force
}
}
function Get-Builds {
@("basic", "banana", "potato") | ForEach-Object {
pdm run pyinstaller "${_}.spec" --noconfirm
}
}
function main {
Get-Builds
Compress-Builds
}
if ($MyInvocation.InvocationName -ne '.') { main }

View File

BIN
img/buses.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/busmode_buttonmenu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
img/nvda-voicemeeter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB

BIN
img/physical_strip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/settings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

BIN
img/virtual_strip.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

227
pdm.lock generated
View File

@@ -2,11 +2,177 @@
# It is not intended for manual editing. # It is not intended for manual editing.
[metadata] [metadata]
groups = ["default"] groups = ["default", "build", "lint", "test"]
cross_platform = true strategy = ["cross_platform"]
static_urls = false lock_version = "4.4"
lock_version = "4.3" content_hash = "sha256:ca47eaae0de5aa6bcc3fde33b6c1fa7dc2476aeb680f00bb1c550fe06ad67c55"
content_hash = "sha256:0dfd1ea07c294dd2b837a34ff9d286134e5119c6249e4f9cd6c1ed121de97851"
[[package]]
name = "altgraph"
version = "0.17.3"
summary = "Python graph (network) package"
files = [
{file = "altgraph-0.17.3-py2.py3-none-any.whl", hash = "sha256:c8ac1ca6772207179ed8003ce7687757c04b0b71536f81e2ac5755c6226458fe"},
{file = "altgraph-0.17.3.tar.gz", hash = "sha256:ad33358114df7c9416cdb8fa1eaa5852166c505118717021c6a8c7c7abbd03dd"},
]
[[package]]
name = "black"
version = "23.7.0"
requires_python = ">=3.8"
summary = "The uncompromising code formatter."
dependencies = [
"click>=8.0.0",
"mypy-extensions>=0.4.3",
"packaging>=22.0",
"pathspec>=0.9.0",
"platformdirs>=2",
"tomli>=1.1.0; python_version < \"3.11\"",
]
files = [
{file = "black-23.7.0-cp310-cp310-macosx_10_16_arm64.whl", hash = "sha256:5c4bc552ab52f6c1c506ccae05681fab58c3f72d59ae6e6639e8885e94fe2587"},
{file = "black-23.7.0-cp310-cp310-macosx_10_16_universal2.whl", hash = "sha256:552513d5cd5694590d7ef6f46e1767a4df9af168d449ff767b13b084c020e63f"},
{file = "black-23.7.0-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:86cee259349b4448adb4ef9b204bb4467aae74a386bce85d56ba4f5dc0da27be"},
{file = "black-23.7.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:501387a9edcb75d7ae8a4412bb8749900386eaef258f1aefab18adddea1936bc"},
{file = "black-23.7.0-cp310-cp310-win_amd64.whl", hash = "sha256:fb074d8b213749fa1d077d630db0d5f8cc3b2ae63587ad4116e8a436e9bbe995"},
{file = "black-23.7.0-py3-none-any.whl", hash = "sha256:9fd59d418c60c0348505f2ddf9609c1e1de8e7493eab96198fc89d9f865e7a96"},
{file = "black-23.7.0.tar.gz", hash = "sha256:022a582720b0d9480ed82576c920a8c1dde97cc38ff11d8d8859b3bd6ca9eedb"},
]
[[package]]
name = "click"
version = "8.1.7"
requires_python = ">=3.7"
summary = "Composable command line interface toolkit"
dependencies = [
"colorama; platform_system == \"Windows\"",
]
files = [
{file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"},
{file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"},
]
[[package]]
name = "colorama"
version = "0.4.6"
requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
summary = "Cross-platform colored terminal text."
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
[[package]]
name = "macholib"
version = "1.16.2"
summary = "Mach-O header analysis and editing"
dependencies = [
"altgraph>=0.17",
]
files = [
{file = "macholib-1.16.2-py2.py3-none-any.whl", hash = "sha256:44c40f2cd7d6726af8fa6fe22549178d3a4dfecc35a9cd15ea916d9c83a688e0"},
{file = "macholib-1.16.2.tar.gz", hash = "sha256:557bbfa1bb255c20e9abafe7ed6cd8046b48d9525db2f9b77d3122a63a2a8bf8"},
]
[[package]]
name = "mypy-extensions"
version = "1.0.0"
requires_python = ">=3.5"
summary = "Type system extensions for programs checked with the mypy type checker."
files = [
{file = "mypy_extensions-1.0.0-py3-none-any.whl", hash = "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d"},
{file = "mypy_extensions-1.0.0.tar.gz", hash = "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"},
]
[[package]]
name = "packaging"
version = "23.1"
requires_python = ">=3.7"
summary = "Core utilities for Python packages"
files = [
{file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"},
{file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"},
]
[[package]]
name = "pathspec"
version = "0.11.2"
requires_python = ">=3.7"
summary = "Utility library for gitignore style pattern matching of file paths."
files = [
{file = "pathspec-0.11.2-py3-none-any.whl", hash = "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20"},
{file = "pathspec-0.11.2.tar.gz", hash = "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"},
]
[[package]]
name = "pefile"
version = "2023.2.7"
requires_python = ">=3.6.0"
summary = "Python PE parsing module"
files = [
{file = "pefile-2023.2.7-py3-none-any.whl", hash = "sha256:da185cd2af68c08a6cd4481f7325ed600a88f6a813bad9dea07ab3ef73d8d8d6"},
{file = "pefile-2023.2.7.tar.gz", hash = "sha256:82e6114004b3d6911c77c3953e3838654b04511b8b66e8583db70c65998017dc"},
]
[[package]]
name = "platformdirs"
version = "3.10.0"
requires_python = ">=3.7"
summary = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
files = [
{file = "platformdirs-3.10.0-py3-none-any.whl", hash = "sha256:d7c24979f292f916dc9cbf8648319032f551ea8c49a4c9bf2fb556a02070ec1d"},
{file = "platformdirs-3.10.0.tar.gz", hash = "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d"},
]
[[package]]
name = "psgdemos"
version = "1.12.1"
summary = "Installs the full set of PySimpleGUI Demo Programs and the Demo Browser."
dependencies = [
"PySimpleGUI",
]
files = [
{file = "psgdemos-1.12.1-py3-none-any.whl", hash = "sha256:a035540dd0ff92f410aed9b7af8d5a641d9d5a9eac3e0072ef115adf06abb447"},
{file = "psgdemos-1.12.1.tar.gz", hash = "sha256:4108af795477531a9b1c8675b9aa9b6628c109e660f6954baf8ba2dc3b5806e9"},
]
[[package]]
name = "pyinstaller"
version = "5.13.0"
requires_python = "<3.13,>=3.7"
summary = "PyInstaller bundles a Python application and all its dependencies into a single package."
dependencies = [
"altgraph",
"macholib>=1.8; sys_platform == \"darwin\"",
"pefile>=2022.5.30; sys_platform == \"win32\"",
"pyinstaller-hooks-contrib>=2021.4",
"pywin32-ctypes>=0.2.1; sys_platform == \"win32\"",
"setuptools>=42.0.0",
]
files = [
{file = "pyinstaller-5.13.0-py3-none-macosx_10_13_universal2.whl", hash = "sha256:7fdd319828de679f9c5e381eff998ee9b4164bf4457e7fca56946701cf002c3f"},
{file = "pyinstaller-5.13.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:0df43697c4914285ecd333be968d2cd042ab9b2670124879ee87931d2344eaf5"},
{file = "pyinstaller-5.13.0-py3-none-manylinux2014_i686.whl", hash = "sha256:28d9742c37e9fb518444b12f8c8ab3cb4ba212d752693c34475c08009aa21ccf"},
{file = "pyinstaller-5.13.0-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:e5fb17de6c325d3b2b4ceaeb55130ad7100a79096490e4c5b890224406fa42f4"},
{file = "pyinstaller-5.13.0-py3-none-manylinux2014_s390x.whl", hash = "sha256:78975043edeb628e23a73fb3ef0a273cda50e765f1716f75212ea3e91b09dede"},
{file = "pyinstaller-5.13.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:cd7d5c06f2847195a23d72ede17c60857d6f495d6f0727dc6c9bc1235f2eb79c"},
{file = "pyinstaller-5.13.0-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:24009eba63cfdbcde6d2634e9c87f545eb67249ddf3b514e0cd3b2cdaa595828"},
{file = "pyinstaller-5.13.0-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:1fde4381155f21d6354dc450dcaa338cd8a40aaacf6bd22b987b0f3e1f96f3ee"},
{file = "pyinstaller-5.13.0-py3-none-win32.whl", hash = "sha256:2d03419904d1c25c8968b0ad21da0e0f33d8d65716e29481b5bd83f7f342b0c5"},
{file = "pyinstaller-5.13.0-py3-none-win_amd64.whl", hash = "sha256:9fc27c5a853b14a90d39c252707673c7a0efec921cd817169aff3af0fca8c127"},
{file = "pyinstaller-5.13.0-py3-none-win_arm64.whl", hash = "sha256:3a331951f9744bc2379ea5d65d36f3c828eaefe2785f15039592cdc08560b262"},
{file = "pyinstaller-5.13.0.tar.gz", hash = "sha256:5e446df41255e815017d96318e39f65a3eb807e74a796c7e7ff7f13b6366a2e9"},
]
[[package]]
name = "pyinstaller-hooks-contrib"
version = "2023.7"
requires_python = ">=3.7"
summary = "Community maintained hooks for PyInstaller"
files = [
{file = "pyinstaller-hooks-contrib-2023.7.tar.gz", hash = "sha256:0c436a4c3506020e34116a8a7ddfd854c1ad6ddca9a8cd84500bd6e69c9e68f9"},
{file = "pyinstaller_hooks_contrib-2023.7-py2.py3-none-any.whl", hash = "sha256:3c10df14c0f71ab388dfbf1625375b087e7330d9444cbfd2b310ba027fa0cff0"},
]
[[package]] [[package]]
name = "pyparsing" name = "pyparsing"
@@ -27,6 +193,51 @@ files = [
{file = "PySimpleGUI-4.60.5.tar.gz", hash = "sha256:31014d1cc5eef1373d7e93564ff2604662645cc774a939b1f01aa253e7f9d78b"}, {file = "PySimpleGUI-4.60.5.tar.gz", hash = "sha256:31014d1cc5eef1373d7e93564ff2604662645cc774a939b1f01aa253e7f9d78b"},
] ]
[[package]]
name = "pywin32-ctypes"
version = "0.2.2"
requires_python = ">=3.6"
summary = "A (partial) reimplementation of pywin32 using ctypes/cffi"
files = [
{file = "pywin32-ctypes-0.2.2.tar.gz", hash = "sha256:3426e063bdd5fd4df74a14fa3cf80a0b42845a87e1d1e81f6549f9daec593a60"},
{file = "pywin32_ctypes-0.2.2-py3-none-any.whl", hash = "sha256:bf490a1a709baf35d688fe0ecf980ed4de11d2b3e37b51e5442587a75d9957e7"},
]
[[package]]
name = "ruff"
version = "0.0.291"
requires_python = ">=3.7"
summary = "An extremely fast Python linter, written in Rust."
files = [
{file = "ruff-0.0.291-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:b97d0d7c136a85badbc7fd8397fdbb336e9409b01c07027622f28dcd7db366f2"},
{file = "ruff-0.0.291-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:6ab44ea607967171e18aa5c80335237be12f3a1523375fa0cede83c5cf77feb4"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a04b384f2d36f00d5fb55313d52a7d66236531195ef08157a09c4728090f2ef0"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:b727c219b43f903875b7503a76c86237a00d1a39579bb3e21ce027eec9534051"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:87671e33175ae949702774071b35ed4937da06f11851af75cd087e1b5a488ac4"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:b75f5801547f79b7541d72a211949754c21dc0705c70eddf7f21c88a64de8b97"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b09b94efdcd162fe32b472b2dd5bf1c969fcc15b8ff52f478b048f41d4590e09"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:8d5b56bc3a2f83a7a1d7f4447c54d8d3db52021f726fdd55d549ca87bca5d747"},
{file = "ruff-0.0.291-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:13f0d88e5f367b2dc8c7d90a8afdcfff9dd7d174e324fd3ed8e0b5cb5dc9b7f6"},
{file = "ruff-0.0.291-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b3eeee1b1a45a247758ecdc3ab26c307336d157aafc61edb98b825cadb153df3"},
{file = "ruff-0.0.291-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:6c06006350c3bb689765d71f810128c9cdf4a1121fd01afc655c87bab4fb4f83"},
{file = "ruff-0.0.291-py3-none-musllinux_1_2_i686.whl", hash = "sha256:fd17220611047de247b635596e3174f3d7f2becf63bd56301fc758778df9b629"},
{file = "ruff-0.0.291-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5383ba67ad360caf6060d09012f1fb2ab8bd605ab766d10ca4427a28ab106e0b"},
{file = "ruff-0.0.291-py3-none-win32.whl", hash = "sha256:1d5f0616ae4cdc7a938b493b6a1a71c8a47d0300c0d65f6e41c281c2f7490ad3"},
{file = "ruff-0.0.291-py3-none-win_amd64.whl", hash = "sha256:8a69bfbde72db8ca1c43ee3570f59daad155196c3fbe357047cd9b77de65f15b"},
{file = "ruff-0.0.291-py3-none-win_arm64.whl", hash = "sha256:d867384a4615b7f30b223a849b52104214442b5ba79b473d7edd18da3cde22d6"},
{file = "ruff-0.0.291.tar.gz", hash = "sha256:c61109661dde9db73469d14a82b42a88c7164f731e6a3b0042e71394c1c7ceed"},
]
[[package]]
name = "setuptools"
version = "68.1.2"
requires_python = ">=3.8"
summary = "Easily download, build, install, upgrade, and uninstall Python packages"
files = [
{file = "setuptools-68.1.2-py3-none-any.whl", hash = "sha256:3d8083eed2d13afc9426f227b24fd1659489ec107c0e86cec2ffdde5c92e790b"},
{file = "setuptools-68.1.2.tar.gz", hash = "sha256:3d4dfa6d95f1b101d695a6160a7626e15583af71a5f52176efa5d39a054d475d"},
]
[[package]] [[package]]
name = "tomli" name = "tomli"
version = "2.0.1" version = "2.0.1"
@@ -39,13 +250,13 @@ files = [
[[package]] [[package]]
name = "voicemeeter-api" name = "voicemeeter-api"
version = "2.4.8" version = "2.5.2"
requires_python = ">=3.10,<4.0" requires_python = ">=3.10,<4.0"
summary = "A Python wrapper for the Voiceemeter API" summary = "A Python wrapper for the Voiceemeter API"
dependencies = [ dependencies = [
"tomli<3.0.0,>=2.0.1; python_version < \"3.11\"", "tomli<3.0.0,>=2.0.1; python_version < \"3.11\"",
] ]
files = [ files = [
{file = "voicemeeter_api-2.4.8-py3-none-any.whl", hash = "sha256:a3ff9e6f7516d2adedde93f6976526b385d8ae6d86598bfe541a44f498f42ea6"}, {file = "voicemeeter_api-2.5.2-py3-none-any.whl", hash = "sha256:304c14a6eef5f95d8b883e8e1752d23f17c3d662d25a28d114d33134f62e93ec"},
{file = "voicemeeter_api-2.4.8.tar.gz", hash = "sha256:0d37a9f2af0f68087aa9c76a8cfb2ba44c6b75bb344e8dfa9fd18ad2c862730c"}, {file = "voicemeeter_api-2.5.2.tar.gz", hash = "sha256:e2b9558a38ed290b184a3e46b598c0a716cef2e64521431f84a46e1180d539ca"},
] ]

View File

@@ -1,6 +1,6 @@
[project] [project]
name = "nvda_voicemeeter" name = "nvda_voicemeeter"
version = "0.1.0" version = "0.5.6"
description = "A Voicemeeter app compatible with NVDA" description = "A Voicemeeter app compatible with NVDA"
authors = [ authors = [
{ name = "onyx-and-iris", email = "code@onyxandiris.online" }, { name = "onyx-and-iris", email = "code@onyxandiris.online" },
@@ -8,9 +8,119 @@ authors = [
dependencies = [ dependencies = [
"pysimplegui>=4.60.5", "pysimplegui>=4.60.5",
"pyparsing>=3.1.1", "pyparsing>=3.1.1",
"voicemeeter-api>=2.4.8", "voicemeeter-api>=2.5.2",
] ]
requires-python = ">=3.10" requires-python = ">=3.10,<3.12"
readme = "README.md" readme = "README.md"
license = {text = "MIT"}
[project.license]
text = "MIT"
[tool.pdm.dev-dependencies]
build = [
"pyinstaller>=5.1",
]
lint = [
"black>=23.7.0",
"ruff>=0.0.291",
]
test = [
"psgdemos>=1.12.1",
]
[tool.pdm.scripts.build]
shell = "build.ps1"
[tool.black]
line-length = 119
[tool.ruff]
select = [
"E",
"F",
]
ignore = [
"E501",
]
fixable = [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"T",
"W",
"ANN",
"ARG",
"BLE",
"COM",
"DJ",
"DTZ",
"EM",
"ERA",
"EXE",
"FBT",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PTH",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"UP",
"YTT",
]
unfixable = []
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
]
line-length = 119
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
target-version = "py310"
[tool.ruff.mccabe]
max-complexity = 10
[tool.ruff.per-file-ignores]
"__init__.py" = [
"E402",
"F401",
]

View File

@@ -1 +1,14 @@
from .window import request_window_object as build import subprocess as sp
import time
from .cdll import NVDA_PATH
from .window import request_window_object as draw
def launch(delay=1):
if NVDA_PATH:
sp.Popen([NVDA_PATH], shell=True)
time.sleep(delay)
__ALL__ = ["launch", "draw"]

View File

@@ -0,0 +1,499 @@
import PySimpleGUI as psg
from . import util
from .compound import LabelSlider
class Builder:
"""Responsible for building the Window layout"""
def __init__(self, window):
self.window = window
self.vm = self.window.vm
self.kind = self.vm.kind
def run(self) -> list:
menu = [[self.make_menu()]]
layout0 = []
if self.kind.name == "basic":
steps = (
self.make_tab0_row0,
self.make_tab0_row1,
self.make_tab0_row5,
)
else:
steps = (
self.make_tab0_row0,
self.make_tab0_row1,
self.make_tab0_row3,
self.make_tab0_row4,
self.make_tab0_row5,
)
for step in steps:
layout0.append([step()])
layout1_1 = []
steps = (self.make_tab1_button_rows,)
for step in steps:
layout1_1.append([step()])
layout1_2 = []
steps = (self.make_tab1_slider_rows,)
for step in steps:
layout1_2.append([step()])
layout2_1 = []
steps = (self.make_tab2_button_rows,)
for step in steps:
layout2_1.append([step()])
layout2_2 = []
steps = (self.make_tab2_slider_rows,)
for step in steps:
layout2_2.append([step()])
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()])
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]]
def make_menu(self) -> psg.Menu:
menu_def = [
[
"&Voicemeeter",
[
"Restart Audio Engine::MENU",
"Save Settings::MENU",
"Load Settings::MENU",
"Load Settings on Startup ::MENU",
],
],
]
return psg.Menu(menu_def, key="menus")
def make_tab0_row0(self) -> psg.Frame:
"""tab0 row0 represents hardware ins"""
def add_physical_device_opts(layout):
devices = util.get_input_device_list(self.vm)
devices.append("- remove device selection -")
layout.append(
[
psg.ButtonMenu(
f"IN {i + 1}",
size=(6, 3),
menu_def=["", devices],
key=f"HARDWARE IN||{i + 1}",
)
for i in range(self.kind.phys_in)
]
)
hardware_in = []
[step(hardware_in) for step in (add_physical_device_opts,)]
return psg.Frame("Hardware In", hardware_in)
def make_tab0_row1(self) -> psg.Frame:
"""tab0 row1 represents hardware outs"""
def add_physical_device_opts(layout):
if self.kind.name == "basic":
num_outs = self.kind.phys_out + self.kind.virt_out
else:
num_outs = self.kind.phys_out
layout.append(
[
psg.ButtonMenu(
f"A{i + 1}",
size=(6, 3),
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 = []
[step(hardware_out) for step in (add_physical_device_opts,)]
return psg.Frame("Hardware Out", hardware_out)
def make_tab0_row3(self) -> psg.Frame:
"""tab0 row3 represents patch composite"""
def add_physical_device_opts(layout):
outputs = util.get_patch_composite_list(self.kind)
layout.append(
[
psg.ButtonMenu(
f"PC{i + 1}",
size=(5, 2),
menu_def=["", outputs],
key=f"PATCH COMPOSITE||PC{i + 1}",
)
for i in range(self.kind.composite)
]
)
hardware_out = []
[step(hardware_out) for step in (add_physical_device_opts,)]
return psg.Frame("PATCH COMPOSITE", hardware_out)
def make_tab0_row4(self) -> psg.Frame:
"""tab0 row4 represents patch insert"""
def add_insert_checkboxes(layout, i):
if i <= self.kind.phys_in:
[
layout.append(
[
psg.Checkbox(
text=channel,
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}",
)
],
)
for j, channel in enumerate(("LEFT", "RIGHT"))
]
else:
layout.append(
[
psg.Checkbox(
text=channel,
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}",
)
for j, channel in enumerate(("LEFT", "RIGHT", "C", "LFE", "SL", "SR", "BL", "BR"))
],
)
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:
[step(checkbox_list, i + 1) for step in (add_insert_checkboxes,)]
inner.append(psg.Frame(f"In#{i + 1}", checkbox_list))
else:
[step(checkbox_list, i + 1) for step in (add_insert_checkboxes,)]
asio_checkboxes.append([psg.Frame(f"In#{i + 1}", checkbox_list)])
asio_checkboxes.insert(0, inner)
return psg.Frame("PATCH INSERT", asio_checkboxes)
def make_tab0_row5(self) -> psg.Frame:
"""tab0 row5 represents advanced settings"""
return psg.Frame(
"ADVANCED SETTINGS",
[
[
psg.Button(
"ADVANCED SETTINGS",
size=(20, 2),
key="ADVANCED SETTINGS",
)
],
],
key="ADVANCED SETTINGS 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):
layout.append(
[
psg.Button(
f"A{j + 1}" if j < self.kind.phys_out else f"B{j - self.kind.phys_out + 1}",
size=(4, 2),
key=f"STRIP {i}||A{j + 1}"
if j < self.kind.phys_out
else f"STRIP {i}||B{j - self.kind.phys_out + 1}",
)
for j in range(self.kind.phys_out + self.kind.virt_out)
],
)
layout.append(
[
psg.Button("Mono", size=(6, 2), key=f"STRIP {i}||MONO"),
psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"),
psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"),
],
)
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_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_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,
disabled=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):
layout.append(
[
psg.Button(
f"A{j + 1}" if j < self.kind.phys_out else f"B{j - self.kind.phys_out + 1}",
size=(4, 2),
key=f"STRIP {i}||A{j + 1}"
if j < self.kind.phys_out
else f"STRIP {i}||B{j - self.kind.phys_out + 1}",
)
for j in range(self.kind.phys_out + self.kind.virt_out)
]
)
if i == self.kind.phys_in + 1:
layout.append(
[
psg.Button("K", size=(6, 2), key=f"STRIP {i}||KARAOKE"),
psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"),
psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"),
],
)
else:
layout.append(
[
psg.Button("MC", size=(6, 2), key=f"STRIP {i}||MC"),
psg.Button("Solo", size=(6, 2), key=f"STRIP {i}||SOLO"),
psg.Button("Mute", size=(6, 2), key=f"STRIP {i}||MUTE"),
],
)
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_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_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,
disabled=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):
params = ["MONO", "EQ", "MUTE"]
if self.kind.name == "basic":
params.remove("EQ")
busmodes = [util._bus_mode_map[mode] for mode in util.get_bus_modes(self.vm)]
layout.append(
[
*[
psg.Button(
param.capitalize(),
size=(6, 2),
key=f"BUS {i}||{param}",
)
for param in params
],
psg.ButtonMenu(
"BUSMODE",
size=(12, 2),
menu_def=["", busmodes],
key=f"BUS {i}||MODE",
),
]
)
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_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.Text("Gain"),
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,
disabled=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)

View File

@@ -1,9 +1,45 @@
import ctypes as ct import ctypes as ct
import platform
import winreg
from pathlib import Path from pathlib import Path
from .errors import NVDAVMError
bits = 64 if ct.sizeof(ct.c_voidp) == 8 else 32 bits = 64 if ct.sizeof(ct.c_voidp) == 8 else 32
if platform.system() != "Windows":
raise NVDAVMError("Only Windows OS supported")
REG_KEY = "\\".join(
filter(
None,
(
"SOFTWARE",
"WOW6432Node" if bits == 64 else "",
"Microsoft",
"Windows",
"CurrentVersion",
"Uninstall",
"NVDA",
),
)
)
def get_nvdapath():
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"{}".format(REG_KEY)) as nvda_key:
return winreg.QueryValueEx(nvda_key, r"UninstallDirectory")[0]
try:
NVDA_PATH = Path(get_nvdapath()) / "nvda.exe"
except FileNotFoundError:
NVDA_PATH = ""
controller_path = Path(__file__).parents[2].resolve() / "controllerClient" controller_path = Path(__file__).parents[2].resolve() / "controllerClient"
if not controller_path.exists():
controller_path = Path("controllerClient")
DLL_PATH = controller_path / f"x{64 if bits == 64 else 86}" / f"nvdaControllerClient{bits}.dll" DLL_PATH = controller_path / f"x{64 if bits == 64 else 86}" / f"nvdaControllerClient{bits}.dll"

View File

@@ -0,0 +1,205 @@
from typing import Union
import PySimpleGUI as psg
from . import util
class LabelSlider(psg.Frame):
"""Compound Label Slider Strip 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
class CompSlider(psg.Slider):
"""Compressor Slider element"""
def __init__(self, vm, index, param):
self.vm = vm
self.index = index
super().__init__(
disable_number_display=True,
expand_x=True,
enable_events=True,
orientation="horizontal",
key=f"COMPRESSOR||SLIDER {param}",
**self.default_params(param),
)
def default_params(self, param):
match param:
case "INPUT GAIN":
return {
"range": (-24, 24),
"default_value": self.vm.strip[self.index].comp.gainin,
"resolution": 0.1,
"disabled": True,
}
case "RATIO":
return {
"range": (1, 8),
"default_value": self.vm.strip[self.index].comp.ratio,
"resolution": 0.1,
}
case "THRESHOLD":
return {
"range": (-40, -3),
"default_value": self.vm.strip[self.index].comp.threshold,
"resolution": 0.1,
}
case "ATTACK":
return {
"range": (0, 200),
"default_value": self.vm.strip[self.index].comp.attack,
"resolution": 0.1,
}
case "RELEASE":
return {
"range": (0, 5000),
"default_value": self.vm.strip[self.index].comp.release,
"resolution": 0.1,
}
case "KNEE":
return {
"range": (0, 1),
"default_value": self.vm.strip[self.index].comp.knee,
"resolution": 0.01,
}
case "OUTPUT GAIN":
return {
"range": (-24, 24),
"default_value": self.vm.strip[self.index].comp.gainout,
"resolution": 0.1,
"disabled": True,
}
@staticmethod
def check_bounds(param, val):
match param:
case "RATIO":
val = util.check_bounds(val, (1, 8))
case "THRESHOLD":
val = util.check_bounds(val, (-40, -3))
case "ATTACK":
val = util.check_bounds(val, (0, 200))
case "RELEASE":
val = util.check_bounds(val, (0, 5000))
case "KNEE":
val = util.check_bounds(val, (0, 1))
return val
class GateSlider(psg.Slider):
def __init__(self, vm, index, param):
self.vm = vm
self.index = index
super().__init__(
disable_number_display=True,
expand_x=True,
enable_events=True,
orientation="horizontal",
key=f"GATE||SLIDER {param}",
**self.default_params(param),
)
def default_params(self, param):
match param:
case "THRESHOLD":
return {
"range": (-60, -10),
"default_value": self.vm.strip[self.index].gate.threshold,
"resolution": 0.1,
}
case "DAMPING":
return {
"range": (-60, -10),
"default_value": self.vm.strip[self.index].gate.damping,
"resolution": 0.1,
}
case "BPSIDECHAIN":
return {
"range": (100, 4000),
"default_value": self.vm.strip[self.index].gate.bpsidechain,
"resolution": 1,
}
case "ATTACK":
return {
"range": (0, 1000),
"default_value": self.vm.strip[self.index].gate.attack,
"resolution": 0.1,
}
case "HOLD":
return {
"range": (0, 5000),
"default_value": self.vm.strip[self.index].gate.hold,
"resolution": 0.1,
}
case "RELEASE":
return {
"range": (0, 5000),
"default_value": self.vm.strip[self.index].gate.release,
"resolution": 0.1,
}
@staticmethod
def check_bounds(param, val):
match param:
case "THRESHOLD":
val = util.check_bounds(val, (-60, -10))
case "DAMPING MAX":
val = util.check_bounds(val, (-60, -10))
case "BPSIDECHAIN":
val = util.check_bounds(val, (100, 4000))
case "ATTACK":
val = util.check_bounds(val, (0, 1000))
case "HOLD":
val = util.check_bounds(val, (0, 5000))
case "RELEASE":
val = util.check_bounds(val, (0, 5000))
return val
class LabelSliderAdvanced(psg.Frame):
"""Compound Label Slider element for Advanced Comp|Gate"""
def __init__(self, parent, index, param, slider_cls: Union[CompSlider, GateSlider], *args, **kwargs):
label_map = {
"DAMPING": "Damping Max",
"BPSIDECHAIN": "BP Sidechain",
}
layout = [
[
psg.Text(label_map.get(param, param.title()), size=10),
slider_cls(parent.vm, index, param),
]
]
super().__init__(None, layout=layout, border_width=0, pad=0, *args, **kwargs)

View File

@@ -0,0 +1,11 @@
class NVDAVMError(Exception):
"""Base NVDAVM error class"""
class NVDAVMCAPIError(NVDAVMError):
"""Exception raised when the NVDA C-API returns an error code"""
def __init__(self, fn_name, code):
self.fn_name = fn_name
self.code = code
super().__init__(f"{self.fn_name} returned {self.code}")

View File

@@ -1,26 +1,95 @@
def _make_cache(vm) -> dict: def _make_hardware_ins_cache(vm) -> dict:
return {**{f"HARDWARE IN||{i + 1}": vm.strip[i].device.name for i in range(vm.kind.phys_in)}}
def _make_hardware_outs_cache(vm) -> dict:
hw_outs = {**{f"HARDWARE OUT||A{i + 1}": vm.bus[i].device.name for i in range(vm.kind.phys_out)}}
if vm.kind.name == "basic":
hw_outs |= {"HARDWARE OUT||A2": vm.bus[1].device.name}
return hw_outs
def _make_param_cache(vm, channel_type) -> dict:
params = {}
if channel_type == "strip":
match vm.kind.name: match vm.kind.name:
case "basic": case "basic":
return { params |= {
**{f"BUTTON||strip {i} A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
} }
case "banana": case "banana":
return { params |= {
**{f"BUTTON||strip {i} A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)},
} }
case "potato": case "potato":
return { params |= {
**{f"BUTTON||strip {i} A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A4": vm.strip[i].A4 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A4": vm.strip[i].A4 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} A5": vm.strip[i].A5 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||A5": vm.strip[i].A5 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)},
**{f"BUTTON||strip {i} B3": vm.strip[i].B3 for i in range(vm.kind.num_strip)}, **{f"STRIP {i}||B3": vm.strip[i].B3 for i in range(vm.kind.num_strip)},
} }
params |= {
**{f"STRIP {i}||MONO": vm.strip[i].mono for i in range(vm.kind.phys_in)},
**{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)},
}
for i in range(vm.kind.phys_in, vm.kind.phys_in + vm.kind.virt_in):
if i == vm.kind.phys_in + 1:
params[f"STRIP {i}||KARAOKE"] = vm.strip[i].k
else:
params[f"STRIP {i}||MC"] = vm.strip[i].mc
else:
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:
return {
**{
f"STRIP {i}||LABEL": vm.strip[i].label if vm.strip[i].label else f"Hardware Input {i + 1}"
for i in range(vm.kind.phys_in)
},
**{
f"STRIP {i}||LABEL": vm.strip[i].label if vm.strip[i].label else f"Virtual Input {i - vm.kind.phys_in + 1}"
for i in range(vm.kind.phys_in, vm.kind.phys_in + vm.kind.virt_in)
},
**{
f"BUS {i}||LABEL": vm.bus[i].label if vm.bus[i].label else f"Physical Bus {i + 1}"
for i in range(vm.kind.phys_out)
},
**{
f"BUS {i}||LABEL": vm.bus[i].label if vm.bus[i].label else f"Virtual Bus {i - vm.kind.phys_out + 1}"
for i in range(vm.kind.phys_out, vm.kind.phys_out + vm.kind.virt_out)
},
}
def _make_patch_asio_cache(vm) -> dict:
params = {}
if vm.kind.name != "basic":
params |= {**{f"ASIO INPUT SPINBOX||{i}": vm.patch.asio[i].get() for i in range(vm.kind.phys_out * 2)}}
for i in range(vm.kind.phys_out - 1):
target = getattr(vm.patch, f"A{i + 2}")
params |= {**{f"ASIO OUTPUT A{i + 2} SPINBOX||{j}": target[j].get() for j in range(vm.kind.num_bus)}}
return params
def _make_patch_insert_cache(vm) -> dict:
params = {}
if vm.kind.name != "basic":
params |= {**{f"INSERT CHECKBOX||{i}": vm.patch.insert[i].on for i in range(vm.kind.num_strip_levels)}}
return params

View File

@@ -1,4 +1,5 @@
from .cdll import libc from .cdll import libc
from .errors import NVDAVMCAPIError
class CBindings: class CBindings:
@@ -10,14 +11,14 @@ class CBindings:
def call(self, fn, *args, ok=(0,)): def call(self, fn, *args, ok=(0,)):
retval = fn(*args) retval = fn(*args)
if retval not in ok: if retval not in ok:
raise RuntimeError(f"{fn.__name__} returned {retval}") raise NVDAVMCAPIError(fn.__name__, retval)
return retval return retval
class Nvda(CBindings): class Nvda(CBindings):
@property @property
def is_running(self): def is_running(self):
return self.call(self.bind_test_if_running, ok=(0, 1)) == 0 return self.call(self.bind_test_if_running) == 0
def speak(self, text): def speak(self, text):
self.call(self.bind_speak_text, text) self.call(self.bind_speak_text, text)

View File

@@ -1,10 +1,15 @@
from pyparsing import Group, OneOrMore, Optional, Suppress, Word, alphanums from pyparsing import Group, OneOrMore, Optional, Suppress, Word, alphanums, restOfLine
class Parser: class Parser:
def __init__(self): def __init__(self):
self.widget = Group(OneOrMore(Word(alphanums))) self.widget = Group(OneOrMore(Word(alphanums)))
self.token = Suppress("||") self.widget_token = Suppress("||")
self.identifier = Group(OneOrMore(Word(alphanums))) self.identifier = Group(OneOrMore(Word(alphanums)))
self.event = OneOrMore(Word(alphanums)) self.event = Group(OneOrMore(Word(alphanums)))
self.match = self.widget + self.token + self.identifier + Optional(self.token) + Optional(self.event) self.menu_token = Suppress("::")
self.match = (
self.widget + self.widget_token + self.identifier + Optional(self.widget_token) + Optional(self.event)
| self.identifier + self.menu_token + self.event
| restOfLine
)

View File

@@ -0,0 +1,822 @@
import logging
from pathlib import Path
import PySimpleGUI as psg
from . import util
from .compound import CompSlider, GateSlider, LabelSliderAdvanced
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 [_, ["KEY", "ENTER"]]:
popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
popup.close()
if filepath:
return Path(filepath)
def on_pdirty(self):
if self.popup.Title == "Advanced Settings":
if self.kind.name != "basic":
for key, value in self.window.cache["asio"].items():
if "INPUT" in key:
identifier, i = key.split("||")
partial = util.get_channel_identifier_list(self.window.vm)[int(i)]
self.popup[f"{identifier}||{partial}"].update(value=value)
elif "OUTPUT" in key:
self.popup[key].update(value=value)
if self.popup.Title == "Advanced Compressor":
for param in ("RATIO", "THRESHOLD", "ATTACK", "RELEASE", "KNEE"):
self.popup[f"COMPRESSOR||SLIDER {param}"].update(
value=getattr(self.window.vm.strip[self.index].comp, param.lower())
)
self.popup["COMPRESSOR||SLIDER INPUT GAIN"].update(value=self.window.vm.strip[self.index].comp.gainin)
self.popup["COMPRESSOR||SLIDER OUTPUT GAIN"].update(value=self.window.vm.strip[self.index].comp.gainout)
elif self.popup.Title == "Advanced Gate":
for param in ("THRESHOLD", "DAMPING", "BPSIDECHAIN", "ATTACK", "HOLD", "RELEASE"):
self.popup[f"GATE||SLIDER {param}"].update(
value=getattr(self.window.vm.strip[self.index].gate, param.lower())
)
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 [_, ["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 add_patch_asio_input_to_strips(layout, i):
nums = list(range(99))
layout.append(
[
psg.Spin(
nums,
initial_value=self.window.cache["asio"][
f"ASIO INPUT SPINBOX||{util.get_asio_input_spinbox_index(0, i)}"
],
size=2,
enable_events=True,
key=f"ASIO INPUT SPINBOX||IN{i} 0",
)
],
)
layout.append(
[
psg.Spin(
nums,
initial_value=self.window.cache["asio"][
f"ASIO INPUT SPINBOX||{util.get_asio_input_spinbox_index(1, i)}"
],
size=2,
enable_events=True,
key=f"ASIO INPUT SPINBOX||IN{i} 1",
)
],
)
def add_patch_bus_to_asio_outputs(layout, i):
nums = list(range(99))
layout.append(
[
psg.Spin(
nums,
initial_value=self.window.cache["asio"][f"ASIO OUTPUT A{i} SPINBOX||{j}"],
size=2,
enable_events=True,
key=f"ASIO OUTPUT A{i} SPINBOX||{j}",
)
for j in range(self.kind.num_bus)
],
)
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 = []
if self.kind.name != "basic":
inner = []
patch_input_to_strips = ([] for _ in range(self.kind.phys_in))
for i, checkbox_list in enumerate(patch_input_to_strips):
[step(checkbox_list, i + 1) for step in (add_patch_asio_input_to_strips,)]
inner.append(psg.Frame(f"In#{i + 1}", checkbox_list))
layout.append([psg.Frame("PATCH ASIO Inputs to Strips", [inner])])
inner_2 = []
patch_output_to_bus = ([] for _ in range(self.kind.phys_out - 1))
for i, checkbox_list in enumerate(patch_output_to_bus):
[step(checkbox_list, i + 2) for step in (add_patch_bus_to_asio_outputs,)]
inner_2.append([psg.Frame(f"OutA{i + 2}", checkbox_list)])
layout.append([psg.Frame("PATCH BUS to A1 ASIO Outputs", [*inner_2])])
steps = (_make_buffering_frame,)
for step in steps:
layout.append([step()])
layout.append([psg.Button("Exit", size=(8, 2))])
self.popup = psg.Window(title, layout, finalize=True)
if self.kind.name != "basic":
for i in range(self.kind.phys_out):
self.popup[f"ASIO INPUT SPINBOX||IN{i + 1} 0"].Widget.config(state="readonly")
self.popup[f"ASIO INPUT SPINBOX||IN{i + 1} 1"].Widget.config(state="readonly")
for i in range(self.kind.phys_out - 1):
for j in range(self.kind.num_bus):
self.popup[f"ASIO OUTPUT A{i + 2} SPINBOX||{j}"].Widget.config(state="readonly")
if self.kind.name != "basic":
for i in range(self.kind.phys_out):
self.popup[f"ASIO INPUT SPINBOX||IN{i + 1} 0"].bind("<FocusIn>", "||FOCUS IN")
self.popup[f"ASIO INPUT SPINBOX||IN{i + 1} 1"].bind("<FocusIn>", "||FOCUS IN")
for i in range(self.kind.phys_out - 1):
for j in range(self.kind.num_bus):
self.popup[f"ASIO OUTPUT A{i + 2} SPINBOX||{j}"].bind("<FocusIn>", "||FOCUS IN")
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
for driver in ("MME", "WDM", "KS", "ASIO"):
self.popup[f"BUFFER {driver}"].Widget.config(**buttonmenu_opts)
self.popup[f"BUFFER {driver}"].bind("<FocusIn>", "||FOCUS IN")
self.popup[f"BUFFER {driver}"].bind("<space>", "||KEY SPACE", propagate=False)
self.popup[f"BUFFER {driver}"].bind("<Return>", "||KEY ENTER", propagate=False)
self.popup["Exit"].bind("<FocusIn>", "||FOCUS IN")
self.popup["Exit"].bind("<Return>", "||KEY ENTER")
self.window.vm.observer.add(self.on_pdirty)
while True:
event, values = self.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 [["ASIO", "INPUT", "SPINBOX"], [in_num, channel]]:
index = util.get_asio_input_spinbox_index(int(channel), int(in_num[-1]))
val = values[f"ASIO INPUT SPINBOX||{in_num} {channel}"]
self.window.vm.patch.asio[index].set(val)
channel = ("left", "right")[int(channel)]
self.window.nvda.speak(str(val))
case [["ASIO", "INPUT", "SPINBOX"], [in_num, channel], ["FOCUS", "IN"]]:
if self.popup.find_element_with_focus() is not None:
val = values[f"ASIO INPUT SPINBOX||{in_num} {channel}"]
channel = ("left", "right")[int(channel)]
num = int(in_num[-1])
self.window.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {val}")
case [["ASIO", "OUTPUT", param, "SPINBOX"], [index]]:
target = getattr(self.window.vm.patch, param)[int(index)]
target.set(values[event])
self.window.nvda.speak(str(values[event]))
case [["ASIO", "OUTPUT", param, "SPINBOX"], [index], ["FOCUS", "IN"]]:
if self.popup.find_element_with_focus() is not None:
val = values[f"ASIO OUTPUT {param} SPINBOX||{index}"]
self.window.nvda.speak(
f"Patch BUS to A1 ASIO Outputs OUT {param} channel {int(index) + 1} {val}"
)
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(self.popup, f"BUFFER {driver}")
case [[button], ["FOCUS", "IN"]]:
self.window.nvda.speak(button)
case [_, ["KEY", "ENTER"]]:
self.popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
self.window.vm.observer.remove(self.on_pdirty)
self.popup.close()
def compressor(self, index, title=None):
self.index = index
def _make_comp_frame() -> psg.Frame:
comp_layout = [
[LabelSliderAdvanced(self.window, index, param, CompSlider)]
for param in ("INPUT GAIN", "RATIO", "THRESHOLD", "ATTACK", "RELEASE", "KNEE", "OUTPUT GAIN")
]
return psg.Frame("ADVANCED COMPRESSOR", comp_layout)
layout = []
steps = (_make_comp_frame,)
for step in steps:
layout.append([step()])
layout.append([psg.Button("MAKEUP", size=(12, 1)), psg.Button("Exit", size=(8, 1))])
self.popup = psg.Window(title, layout, return_keyboard_events=False, finalize=True)
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
for param in ("INPUT GAIN", "RATIO", "THRESHOLD", "ATTACK", "RELEASE", "KNEE", "OUTPUT GAIN"):
self.popup[f"COMPRESSOR||SLIDER {param}"].Widget.config(**buttonmenu_opts)
self.popup[f"COMPRESSOR||SLIDER {param}"].bind("<FocusIn>", "||FOCUS IN")
self.popup[f"COMPRESSOR||SLIDER {param}"].bind("<FocusOut>", "||FOCUS OUT")
for event in ("KeyPress", "KeyRelease"):
event_id = event.removeprefix("Key").upper()
for direction in ("Left", "Right", "Up", "Down"):
self.popup[f"COMPRESSOR||SLIDER {param}"].bind(
f"<{event}-{direction}>", f"||KEY {direction.upper()} {event_id}"
)
self.popup[f"COMPRESSOR||SLIDER {param}"].bind(
f"<Shift-{event}-{direction}>", f"||KEY SHIFT {direction.upper()} {event_id}"
)
self.popup[f"COMPRESSOR||SLIDER {param}"].bind(
f"<Control-{event}-{direction}>", f"||KEY CTRL {direction.upper()} {event_id}"
)
if param == "RELEASE":
self.popup[f"COMPRESSOR||SLIDER {param}"].bind(
f"<Alt-{event}-{direction}>", f"||KEY ALT {direction.upper()} {event_id}"
)
self.popup[f"COMPRESSOR||SLIDER {param}"].bind(
f"<Control-Alt-{event}-{direction}>", f"||KEY CTRL ALT {direction.upper()} {event_id}"
)
self.popup[f"COMPRESSOR||SLIDER {param}"].bind("<Control-Shift-KeyPress-R>", "||KEY CTRL SHIFT R")
self.popup["MAKEUP"].bind("<FocusIn>", "||FOCUS IN")
self.popup["MAKEUP"].bind("<Return>", "||KEY ENTER")
self.popup["Exit"].bind("<FocusIn>", "||FOCUS IN")
self.popup["Exit"].bind("<Return>", "||KEY ENTER")
self.window.vm.observer.add(self.on_pdirty)
while True:
event, values = self.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 [["COMPRESSOR"], ["SLIDER", param]]:
setattr(self.window.vm.strip[index].comp, param.lower(), values[event])
case [["COMPRESSOR"], ["SLIDER", param], ["FOCUS", "IN"]]:
self.window.nvda.speak(f"{param} {values[f'COMPRESSOR||SLIDER {param}']}")
case [
["COMPRESSOR"],
["SLIDER", param],
["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].comp, param.lower())
match input_direction:
case "RIGHT" | "UP":
if param == "KNEE":
val += 0.1
else:
val += 1
case "LEFT" | "DOWN":
if param == "KNEE":
val -= 0.1
else:
val -= 1
val = CompSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].comp, param.lower(), val)
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
if param == "KNEE":
self.window.nvda.speak(str(round(val, 2)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", param],
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].comp, param.lower())
match input_direction:
case "RIGHT" | "UP":
if param == "KNEE":
val += 0.3
elif param == "RELEASE":
val += 5
else:
val += 3
case "LEFT" | "DOWN":
if param == "KNEE":
val -= 0.3
elif param == "RELEASE":
val -= 5
else:
val -= 3
val = CompSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].comp, param.lower(), val)
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
if param == "KNEE":
self.window.nvda.speak(str(round(val, 2)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", param],
["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].comp, param.lower())
match input_direction:
case "RIGHT" | "UP":
if param == "KNEE":
val += 0.01
else:
val += 0.1
case "LEFT" | "DOWN":
if param == "KNEE":
val -= 0.01
else:
val -= 0.1
val = CompSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].comp, param.lower(), val)
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
if param == "KNEE":
self.window.nvda.speak(str(round(val, 2)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", "RELEASE"],
["KEY", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = self.window.vm.strip[index].comp.release
match input_direction:
case "RIGHT" | "UP":
val += 10
case "LEFT" | "DOWN":
val -= 10
val = util.check_bounds(val, (0, 5000))
self.window.vm.strip[index].comp.release = val
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", "RELEASE"],
["KEY", "CTRL", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = self.window.vm.strip[index].comp.release
match input_direction:
case "RIGHT" | "UP":
val += 50
case "LEFT" | "DOWN":
val -= 50
val = util.check_bounds(val, (0, 5000))
self.window.vm.strip[index].comp.release = val
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [["COMPRESSOR"], ["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"]]:
if direction == "INPUT":
self.window.vm.strip[index].comp.gainin = values[event]
else:
self.window.vm.strip[index].comp.gainout = values[event]
case [["COMPRESSOR"], ["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"], ["FOCUS", "IN"]]:
label = f"{direction} GAIN"
self.window.nvda.speak(f"{label} {values[f'COMPRESSOR||SLIDER {label}']}")
case [
["COMPRESSOR"],
["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"],
["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
if direction == "INPUT":
val = self.window.vm.strip[index].comp.gainin
else:
val = self.window.vm.strip[index].comp.gainout
match input_direction:
case "RIGHT" | "UP":
val += 1
case "LEFT" | "DOWN":
val -= 1
val = util.check_bounds(val, (-24, 24))
if direction == "INPUT":
self.window.vm.strip[index].comp.gainin = val
else:
self.window.vm.strip[index].comp.gainout = val
self.popup[f"COMPRESSOR||SLIDER {direction} GAIN"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"],
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
if direction == "INPUT":
val = self.window.vm.strip[index].comp.gainin
else:
val = self.window.vm.strip[index].comp.gainout
match input_direction:
case "RIGHT" | "UP":
val += 3
case "LEFT" | "DOWN":
val -= 3
val = util.check_bounds(val, (-24, 24))
if direction == "INPUT":
self.window.vm.strip[index].comp.gainin = val
else:
self.window.vm.strip[index].comp.gainout = val
self.popup[f"COMPRESSOR||SLIDER {direction} GAIN"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"],
["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
if direction == "INPUT":
val = self.window.vm.strip[index].comp.gainin
else:
val = self.window.vm.strip[index].comp.gainout
match input_direction:
case "RIGHT" | "UP":
val += 0.1
case "LEFT" | "DOWN":
val -= 0.1
val = util.check_bounds(val, (-24, 24))
if direction == "INPUT":
self.window.vm.strip[index].comp.gainin = val
else:
self.window.vm.strip[index].comp.gainout = val
self.popup[f"COMPRESSOR||SLIDER {direction} GAIN"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["COMPRESSOR"],
["SLIDER", "INPUT" | "OUTPUT" as direction, "GAIN"],
["KEY", "CTRL", "SHIFT", "R"],
]:
if direction == "INPUT":
self.window.vm.strip[index].comp.gainin = 0
else:
self.window.vm.strip[index].comp.gainout = 0
self.popup[f"COMPRESSOR||SLIDER {direction} GAIN"].update(value=0)
self.window.nvda.speak(str(0))
case [["COMPRESSOR"], ["SLIDER", param], ["KEY", "CTRL", "SHIFT", "R"]]:
match param:
case "RATIO":
val = 1
case "THRESHOLD":
val = -20
case "ATTACK":
val = 10
case "RELEASE":
val = 50
case "KNEE":
val = 0.5
setattr(self.window.vm.strip[index].comp, param.lower(), val)
self.popup[f"COMPRESSOR||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
case ["MAKEUP"]:
val = not self.window.vm.strip[index].comp.makeup
self.window.vm.strip[index].comp.makeup = val
self.window.nvda.speak("on" if val else "off")
case [[button], ["FOCUS", "IN"]]:
if button == "MAKEUP":
self.window.nvda.speak(
f"{button} {'on' if self.window.vm.strip[index].comp.makeup else 'off'}"
)
else:
self.window.nvda.speak(button)
case [_, ["KEY", "ENTER"]]:
self.popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
self.window.vm.observer.remove(self.on_pdirty)
self.popup.close()
def gate(self, index, title=None):
self.index = index
def _make_gate_frame() -> psg.Frame:
gate_layout = [
[LabelSliderAdvanced(self.window, index, param, GateSlider)]
for param in ("THRESHOLD", "DAMPING", "BPSIDECHAIN", "ATTACK", "HOLD", "RELEASE")
]
return psg.Frame("ADVANCED GATE", gate_layout)
layout = []
steps = (_make_gate_frame,)
for step in steps:
layout.append([step()])
layout.append([psg.Button("Exit", size=(8, 1))])
self.popup = psg.Window(title, layout, return_keyboard_events=False, finalize=True)
buttonmenu_opts = {"takefocus": 1, "highlightthickness": 1}
for param in ("THRESHOLD", "DAMPING", "BPSIDECHAIN", "ATTACK", "HOLD", "RELEASE"):
self.popup[f"GATE||SLIDER {param}"].Widget.config(**buttonmenu_opts)
self.popup[f"GATE||SLIDER {param}"].bind("<FocusIn>", "||FOCUS IN")
self.popup[f"GATE||SLIDER {param}"].bind("<FocusOut>", "||FOCUS OUT")
for event in ("KeyPress", "KeyRelease"):
event_id = event.removeprefix("Key").upper()
for direction in ("Left", "Right", "Up", "Down"):
self.popup[f"GATE||SLIDER {param}"].bind(
f"<{event}-{direction}>", f"||KEY {direction.upper()} {event_id}"
)
self.popup[f"GATE||SLIDER {param}"].bind(
f"<Shift-{event}-{direction}>", f"||KEY SHIFT {direction.upper()} {event_id}"
)
self.popup[f"GATE||SLIDER {param}"].bind(
f"<Control-{event}-{direction}>", f"||KEY CTRL {direction.upper()} {event_id}"
)
if param in ("BPSIDECHAIN", "ATTACK", "HOLD", "RELEASE"):
self.popup[f"GATE||SLIDER {param}"].bind(
f"<Alt-{event}-{direction}>", f"||KEY ALT {direction.upper()} {event_id}"
)
self.popup[f"GATE||SLIDER {param}"].bind(
f"<Control-Alt-{event}-{direction}>", f"||KEY CTRL ALT {direction.upper()} {event_id}"
)
self.popup[f"GATE||SLIDER {param}"].bind("<Control-Shift-KeyPress-R>", "||KEY CTRL SHIFT R")
self.popup["Exit"].bind("<FocusIn>", "||FOCUS IN")
self.popup["Exit"].bind("<Return>", "||KEY ENTER")
self.window.vm.observer.add(self.on_pdirty)
while True:
event, values = self.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 [["GATE"], ["SLIDER", param]]:
setattr(self.window.vm.strip[index].gate, param.lower(), values[event])
case [["GATE"], ["SLIDER", param], ["FOCUS", "IN"]]:
label_map = {
"DAMPING": "Damping Max",
"BPSIDECHAIN": "BP Sidechain",
}
self.window.nvda.speak(f"{label_map.get(param, param)} {values[f'GATE||SLIDER {param}']}")
case [
["GATE"],
["SLIDER", param],
["KEY", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 1
case "LEFT" | "DOWN":
val -= 1
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", param],
["KEY", "CTRL", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 3
case "LEFT" | "DOWN":
val -= 3
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", param],
["KEY", "SHIFT", "LEFT" | "RIGHT" | "UP" | "DOWN" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 0.1
case "LEFT" | "DOWN":
val -= 0.1
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", "BPSIDECHAIN" | "ATTACK" | "HOLD" | "RELEASE" as param],
["KEY", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 10
case "LEFT" | "DOWN":
val -= 10
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [
["GATE"],
["SLIDER", "BPSIDECHAIN" | "ATTACK" | "HOLD" | "RELEASE" as param],
["KEY", "CTRL", "ALT", "LEFT" | "RIGHT" as input_direction, "PRESS" | "RELEASE" as e],
]:
if e == "PRESS":
self.window.vm.event.pdirty = False
val = getattr(self.window.vm.strip[index].gate, param.lower())
match input_direction:
case "RIGHT" | "UP":
val += 50
case "LEFT" | "DOWN":
val -= 50
val = GateSlider.check_bounds(param, val)
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
if param == "BPSIDECHAIN":
self.window.nvda.speak(str(int(val)))
else:
self.window.nvda.speak(str(round(val, 1)))
else:
self.window.vm.event.pdirty = True
case [["GATE"], ["SLIDER", param], ["KEY", "CTRL", "SHIFT", "R"]]:
match param:
case "THRESHOLD":
val = -60
case "DAMPING":
val = -60
case "BPSIDECHAIN":
val = 100
case "ATTACK":
val = 0
case "HOLD":
val = 500
case "RELEASE":
val = 1000
setattr(self.window.vm.strip[index].gate, param.lower(), val)
self.popup[f"GATE||SLIDER {param}"].update(value=val)
self.window.nvda.speak(str(round(val, 1)))
case [[button], ["FOCUS", "IN"]]:
self.window.nvda.speak(button)
case [_, ["KEY", "ENTER"]]:
self.popup.find_element_with_focus().click()
self.logger.debug(f"parsed::{parsed_cmd}")
self.window.vm.observer.remove(self.on_pdirty)
self.popup.close()

View File

@@ -0,0 +1,198 @@
from typing import Iterable
def get_asio_input_spinbox_index(channel, num) -> int:
if channel == 0:
return 2 * num - 2
return 2 * num - 1
def get_insert_checkbox_index(kind, channel, num) -> int:
if num <= kind.phys_in:
if channel == 0:
return 2 * num - 2
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:
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(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:
temp = []
for i in range(kind.phys_out):
[temp.append(f"IN#{i + 1} {channel}") for channel in ("Left", "Right")]
for i in range(kind.phys_out, kind.phys_out + kind.virt_out):
[
temp.append(f"IN#{i + 1} {channel}")
for channel in ("Left", "Right", "Center", "LFE", "SL", "SR", "BL", "BR")
]
temp.append("BUS Channel")
return temp
def get_patch_insert_channels() -> list:
return [
"left",
"right",
"center",
"low frequency effect",
"surround left",
"surround right",
"back left",
"back right",
]
_patch_insert_channels = get_patch_insert_channels()
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:
return ["Settings", "Physical Strip", "Virtual Strip", "Buses"]
def open_context_menu_for_buttonmenu(window, identifier) -> None:
element = window[identifier]
widget = element.widget
x = widget.winfo_rootx()
y = widget.winfo_rooty() + widget.winfo_height()
element.TKMenu.post(x, y)
def get_channel_identifier_list(vm) -> list:
identifiers = []
for i in range(vm.kind.phys_in):
for j in range(2):
identifiers.append(f"IN{i + 1} {j}")
for i in range(vm.kind.phys_in, vm.kind.phys_in + vm.kind.virt_in):
for j in range(8):
identifiers.append(f"IN{i + 1} {j}")
return identifiers
_bus_mode_map = {
"normal": "Normal",
"amix": "Mix Down A",
"bmix": "Mix Down B",
"repeat": "Stereo Repeat",
"composite": "Composite",
"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",
}
_bus_mode_map_reversed = dict((reversed(item) for item in _bus_mode_map.items()))
def get_bus_modes(vm) -> list:
if vm.kind.name == "basic":
return [
"normal",
"amix",
"repeat",
"composite",
]
return [
"normal",
"amix",
"bmix",
"repeat",
"composite",
"tvmix",
"upmix21",
"upmix41",
"upmix61",
"centeronly",
"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
def get_slider_modes() -> Iterable:
return (
"GAIN MODE",
"BASS MODE",
"MID MODE",
"TREBLE MODE",
"AUDIBILITY MODE",
"COMP MODE",
"GATE MODE",
"DENOISER MODE",
"LIMIT MODE",
)
def _get_bus_assignments(kind) -> list:
return [f"A{i}" for i in range(1, kind.phys_out + 1)] + [f"B{i}" for i in range(1, kind.virt_out + 1)]

File diff suppressed because it is too large Load Diff