Compare commits

...

34 Commits

Author SHA1 Message Date
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
9 changed files with 919 additions and 364 deletions

View File

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

View File

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

BIN
img/nvda-voicemeeter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 KiB

View File

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

View File

@@ -1,13 +1,7 @@
import PySimpleGUI as psg
from .util import (
get_asio_checkbox_index,
get_input_device_list,
get_insert_checkbox_index,
get_output_device_list,
get_patch_composite_list,
get_tabs_labels,
)
from . import util
from .compound import LabelSlider
class Builder:
@@ -91,7 +85,7 @@ class Builder:
return psg.Tab(identifier, [[tabgroup]], key=f"tab||{identifier}")
tabs = []
for tab in get_tabs_labels():
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")
@@ -116,7 +110,7 @@ class Builder:
"""tab0 row0 represents hardware ins"""
def add_physical_device_opts(layout):
devices = get_input_device_list(self.vm)
devices = util.get_input_device_list(self.vm)
devices.append("- remove device selection -")
layout.append(
[
@@ -147,7 +141,7 @@ class Builder:
psg.ButtonMenu(
f"A{i + 1}",
size=(6, 3),
menu_def=["", get_output_device_list(i, self.vm)],
menu_def=["", util.get_output_device_list(i, self.vm)],
key=f"HARDWARE OUT||A{i + 1}",
)
for i in range(num_outs)
@@ -167,7 +161,7 @@ class Builder:
[
psg.Spin(
nums,
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{get_asio_checkbox_index(0, i)}"],
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{util.get_asio_checkbox_index(0, i)}"],
size=2,
enable_events=True,
key=f"ASIO CHECKBOX||IN{i} 0",
@@ -178,7 +172,7 @@ class Builder:
[
psg.Spin(
nums,
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{get_asio_checkbox_index(1, i)}"],
initial_value=self.window.cache["asio"][f"ASIO CHECKBOX||{util.get_asio_checkbox_index(1, i)}"],
size=2,
enable_events=True,
key=f"ASIO CHECKBOX||IN{i} 1",
@@ -199,7 +193,7 @@ class Builder:
"""tab0 row3 represents patch composite"""
def add_physical_device_opts(layout):
outputs = get_patch_composite_list(self.vm.kind)
outputs = util.get_patch_composite_list(self.vm.kind)
layout.append(
[
psg.ButtonMenu(
@@ -226,7 +220,9 @@ class Builder:
[
psg.Checkbox(
text=channel,
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
default=self.window.cache["insert"][
f"INSERT CHECKBOX||{util.get_insert_checkbox_index(self.kind, j, i)}"
],
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} {j}",
)
@@ -239,7 +235,9 @@ class Builder:
[
psg.Checkbox(
text=channel,
default=self.vm.patch.insert[get_insert_checkbox_index(self.kind, j, i)].on,
default=self.window.cache["insert"][
f"INSERT CHECKBOX||{util.get_insert_checkbox_index(self.kind, j, i)}"
],
enable_events=True,
key=f"INSERT CHECKBOX||IN{i} {j}",
)
@@ -314,6 +312,7 @@ class Builder:
def add_gain_slider(layout):
layout.append(
[
psg.Text("Gain"),
psg.Slider(
range=(-60, 12),
default_value=self.vm.strip[i].gain,
@@ -323,13 +322,36 @@ class Builder:
enable_events=True,
orientation="horizontal",
key=f"STRIP {i}||SLIDER GAIN",
)
),
]
)
outputs = []
[step(outputs) for step in (add_gain_slider,)]
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL||SLIDER")
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)]
@@ -382,6 +404,7 @@ class Builder:
def add_gain_slider(layout):
layout.append(
[
psg.Text("Gain"),
psg.Slider(
range=(-60, 12),
default_value=self.vm.strip[i].gain,
@@ -391,13 +414,45 @@ class Builder:
enable_events=True,
orientation="horizontal",
key=f"STRIP {i}||SLIDER GAIN",
)
),
]
)
outputs = []
[step(outputs) for step in (add_gain_slider,)]
return psg.Frame(self.window.cache["labels"][f"STRIP {i}||LABEL"], outputs, key=f"STRIP {i}||LABEL||SLIDER")
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 = [

View File

@@ -0,0 +1,35 @@
import PySimpleGUI as psg
class LabelSlider(psg.Frame):
"""Compound Label Slider element"""
def __init__(self, parent, i, param, range_=(0, 10), *args, **kwargs):
self.parent = parent
if param in ("AUDIBILITY", "DENOISER"):
size = 7
else:
size = 4
layout = [
[
psg.Text(param.capitalize(), size=size),
psg.Slider(
range=range_,
default_value=self.default_value(i, param),
resolution=0.1,
disable_number_display=True,
size=(12, 16),
expand_x=True,
enable_events=True,
orientation="horizontal",
key=f"STRIP {i}||SLIDER {param}",
),
]
]
super().__init__(None, layout=layout, border_width=0, pad=0, *args, **kwargs)
def default_value(self, i, param):
target = getattr(self.parent.vm.strip[i], param.lower())
if param in ("COMP", "GATE", "DENOISER"):
return target.knob
return target

View File

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

View File

@@ -1,3 +1,6 @@
from typing import Iterable
def get_asio_checkbox_index(channel, num) -> int:
if channel == 0:
return 2 * num - 2
@@ -8,8 +11,7 @@ def get_insert_checkbox_index(kind, channel, num) -> int:
if num <= kind.phys_in:
if channel == 0:
return 2 * num - 2
else:
return 2 * num - 1
return 2 * num - 1
return (2 * kind.phys_in) + (8 * (num - kind.phys_in - 1)) + channel
@@ -130,10 +132,28 @@ def get_bus_modes(vm) -> list:
]
def check_bounds(val, bounds):
def check_bounds(val, bounds: tuple) -> int | float:
lower, upper = bounds
if val > upper:
val = upper
elif val < lower:
val = lower
return val
def get_slider_params(i, kind) -> Iterable:
if i < kind.phys_in:
if kind.name == "basic":
return ("AUDIBILITY",)
if kind.name == "banana":
return ("COMP", "GATE")
if kind.name == "potato":
return ("COMP", "GATE", "DENOISER")
return ("BASS", "MID", "TREBLE")
def get_full_slider_params(i, kind) -> Iterable:
params = list(get_slider_params(i, kind) + ("GAIN", "LIMIT"))
if kind.name == "basic":
params.remove("LIMIT")
return params

File diff suppressed because it is too large Load Diff