mirror of
https://github.com/onyx-and-iris/nvda-addon-voicemeeter.git
synced 2025-04-19 20:13:46 +01:00
Compare commits
No commits in common. "e9b9295a46d6411f7c65085bf6e0cdd26c5c6585" and "51ccd76c2a7b606caabbb75d9e605197ca57ef88" have entirely different histories.
e9b9295a46
...
51ccd76c2a
77
README.md
77
README.md
@ -1,12 +1,8 @@
|
||||
# NVDA Addon Voicemeeter
|
||||
|
||||
Control Voicemeeter with global hotkeys.
|
||||
Control Voicemeeter GUI with customisable hotkeys.
|
||||
|
||||
## Install
|
||||
|
||||
This addon can be installed through the Add-on store, `Install from external source`. Simply download the [latest Release](https://github.com/onyx-and-iris/nvda-addon-voicemeeter/releases) and load it with NVDA.
|
||||
|
||||
## Default Keybinds
|
||||
## Keybinds
|
||||
|
||||
### Controllers
|
||||
|
||||
@ -26,7 +22,7 @@ This addon can be installed through the Add-on store, `Install from external sou
|
||||
|
||||
- `NVDA+alt+g`: Enable gain slider mode.
|
||||
- `NVDA+alt+c`: Enable comp slider mode.
|
||||
- `NVDA+alt+t`: Enable gate slider mode.
|
||||
- `NVDA+alt+t`: Enable gate sldier mode.
|
||||
- `NVDA+alt+d`: Enable denoiser slider mode.
|
||||
- `NVDA+alt+a`: Enable audibility slider mode.
|
||||
|
||||
@ -47,74 +43,7 @@ This addon can be installed through the Add-on store, `Install from external sou
|
||||
- `NVDA+shift+c`: MC
|
||||
- `NVDA+shift+k`: Karaoke
|
||||
|
||||
### Bus Assignments (A1-A5|B1-B3)
|
||||
|
||||
- `NVDA+shift+1`: Toggle BUS assignment 1 for a strip
|
||||
- `NVDA+shift+2`: Toggle BUS assignment 2 for a strip
|
||||
- `NVDA+shift+3`: Toggle BUS assignment 3 for a strip
|
||||
- `NVDA+shift+4`: Toggle BUS assignment 4 for a strip
|
||||
- `NVDA+shift+5`: Toggle BUS assignment 5 for a strip
|
||||
- `NVDA+shift+6`: Toggle BUS assignment 6 for a strip
|
||||
- `NVDA+shift+7`: Toggle BUS assignment 7 for a strip
|
||||
- `NVDA+shift+8`: Toggle BUS assignment 8 for a strip
|
||||
|
||||
### Announcements
|
||||
|
||||
- `NVDA+shift+q`: Announce current controller.
|
||||
- `NVDA+shift+a`: Announce Voicemeeter kind.
|
||||
|
||||
## Configuration
|
||||
|
||||
By placing a file named `nvda_settings.json` in `User Home Directory / Documents / Voicemeeter` (the same place as your Voicemeeter xml profiles) you can change most of the default keybinds.
|
||||
|
||||
The `voicemeeter` key can take one of three values:
|
||||
|
||||
- `basic`
|
||||
- `banana`
|
||||
- `potato`
|
||||
|
||||
example:
|
||||
|
||||
```json
|
||||
{
|
||||
"voicemeeter": "banana",
|
||||
"keybinds": {
|
||||
"NVDA+alt+k": "strip_mode",
|
||||
"NVDA+alt+l": "bus_mode",
|
||||
"NVDA+alt+g": "gain_mode",
|
||||
"NVDA+alt+c": "comp_mode",
|
||||
"NVDA+alt+t": "gate_mode",
|
||||
"NVDA+alt+d": "denoiser_mode",
|
||||
"NVDA+alt+a": "audibility_mode",
|
||||
"NVDA+shift+q": "announce_controller",
|
||||
"NVDA+shift+z": "announce_voicemeeter_version",
|
||||
"NVDA+shift+s": "toggle_solo",
|
||||
"NVDA+shift+m": "toggle_mute",
|
||||
"NVDA+shift+c": "toggle_mc",
|
||||
"NVDA+shift+k": "karaoke",
|
||||
"NVDA+shift+upArrow": "slider_increase_by_point_one",
|
||||
"NVDA+shift+downArrow": "slider_decrease_by_point_one",
|
||||
"NVDA+shift+alt+upArrow": "slider_increase_by_one",
|
||||
"NVDA+shift+alt+downArrow": "slider_decrease_by_one",
|
||||
"NVDA+shift+control+upArrow": "slider_increase_by_three",
|
||||
"NVDA+shift+control+downArrow": "slider_decrease_by_three",
|
||||
"NVDA+control+1": "bus_assignment",
|
||||
"NVDA+control+2": "bus_assignment",
|
||||
"NVDA+control+3": "bus_assignment",
|
||||
"NVDA+control+4": "bus_assignment",
|
||||
"NVDA+control+5": "bus_assignment",
|
||||
"NVDA+control+6": "bus_assignment",
|
||||
"NVDA+control+7": "bus_assignment",
|
||||
"NVDA+control+8": "bus_assignment"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Would make the following changes:
|
||||
|
||||
- load the plugin in `banana` mode (default is potato)
|
||||
- change the `strip_mode` and `bus_mode` binds to `NVDA+alt+k` and `NVDA+alt+l` respectively
|
||||
- change the `announce_voicemeeter_version` bind to `NVDA+shift+z`
|
||||
- changes the bus assignment binds to `NVDA+control+number`
|
||||
|
||||
All other binds would then be defaults.
|
||||
|
@ -1,16 +1,63 @@
|
||||
import json
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import globalPluginHandler
|
||||
from logHandler import log
|
||||
|
||||
from . import config, util
|
||||
from .commands import CommandsMixin
|
||||
from .controller import Controller
|
||||
from .kinds import KindId, request_kind_map
|
||||
|
||||
|
||||
def _make_gestures():
|
||||
defaults = {
|
||||
"kb:NVDA+alt+s": "strip_mode",
|
||||
"kb:NVDA+alt+b": "bus_mode",
|
||||
"kb:NVDA+alt+g": "slider_mode", # Gate
|
||||
"kb:NVDA+alt+c": "slider_mode", # Comp
|
||||
"kb:NVDA+alt+t": "slider_mode", # Gate
|
||||
"kb:NVDA+alt+d": "slider_mode", # Denoiser
|
||||
"kb:NVDA+alt+a": "slider_mode", # Audibility
|
||||
"kb:NVDA+shift+q": "announce_controller",
|
||||
"kb:NVDA+shift+a": "announce_voicemeeter_version",
|
||||
"kb:NVDA+shift+o": "toggle_mono",
|
||||
"kb:NVDA+shift+s": "toggle_solo",
|
||||
"kb:NVDA+shift+m": "toggle_mute",
|
||||
"kb:NVDA+shift+c": "toggle_mc",
|
||||
"kb:NVDA+shift+k": "karaoke",
|
||||
"kb:NVDA+shift+upArrow": "slider_increase",
|
||||
"kb:NVDA+shift+downArrow": "slider_decrease",
|
||||
"kb:NVDA+shift+alt+upArrow": "slider_increase",
|
||||
"kb:NVDA+shift+alt+downArrow": "slider_decrease",
|
||||
"kb:NVDA+shift+control+upArrow": "slider_increase",
|
||||
"kb:NVDA+shift+control+downArrow": "slider_decrease",
|
||||
}
|
||||
|
||||
overrides = None
|
||||
pn = Path.home() / "Documents" / "Voicemeeter" / "keybinds.json"
|
||||
if pn.exists():
|
||||
with open(pn, "r") as f:
|
||||
data = json.load(f)
|
||||
overrides = {f"kb:{v}": k for k, v in data.items()}
|
||||
log.info("INFO - loading settings from keybinds.json")
|
||||
if overrides:
|
||||
return {**defaults, **overrides}
|
||||
return defaults
|
||||
|
||||
|
||||
def _get_kind_id():
|
||||
pn = Path.home() / "Documents" / "Voicemeeter" / "settings.json"
|
||||
if pn.exists():
|
||||
with open(pn, "r") as f:
|
||||
data = json.load(f)
|
||||
return data["voicemeeter"]
|
||||
return "potato"
|
||||
|
||||
|
||||
class GlobalPlugin(globalPluginHandler.GlobalPlugin, CommandsMixin):
|
||||
__kind_id = config.get("voicemeeter", "potato")
|
||||
__gestures = util._make_gestures(__kind_id)
|
||||
__gestures = _make_gestures()
|
||||
__kind_id = _get_kind_id()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@ -18,7 +65,12 @@ class GlobalPlugin(globalPluginHandler.GlobalPlugin, CommandsMixin):
|
||||
if self.controller.login() == 1:
|
||||
self.controller.run_voicemeeter(KindId[self.__kind_id.upper()])
|
||||
time.sleep(1)
|
||||
self.kind = request_kind_map(self.__kind_id)
|
||||
self.kind = request_kind_map(self.controller.kind_id)
|
||||
|
||||
for i in range(1, self.kind.num_strip + 1):
|
||||
self.bindGesture(f"kb:NVDA+alt+{i}", "index")
|
||||
for i in range(1, self.kind.phys_out + self.kind.virt_out + 1):
|
||||
self.bindGesture(f"kb:NVDA+shift+{i}", "bus_assignment")
|
||||
|
||||
def terminate(self, *args, **kwargs):
|
||||
super().terminate(*args, **kwargs)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import ui
|
||||
from logHandler import log
|
||||
|
||||
from . import context
|
||||
from . import context, util
|
||||
|
||||
|
||||
class CommandsMixin:
|
||||
@ -37,24 +37,18 @@ class CommandsMixin:
|
||||
ui.message(f"Controller for {self.controller.ctx.strategy} {self.controller.ctx.index + 1}")
|
||||
log.info(f"INFO - {self.controller.ctx.strategy} {self.controller.ctx.index} mode")
|
||||
|
||||
def __set_slider_mode(self, mode):
|
||||
self.controller.ctx.slider_mode = mode
|
||||
ui.message(f"{mode} mode enabled")
|
||||
|
||||
def script_gain_mode(self, _):
|
||||
self.__set_slider_mode("gain")
|
||||
|
||||
def script_comp_mode(self, _):
|
||||
self.__set_slider_mode("comp")
|
||||
|
||||
def script_gate_mode(self, _):
|
||||
self.__set_slider_mode("gate")
|
||||
|
||||
def script_denoiser_mode(self, _):
|
||||
self.__set_slider_mode("denoiser")
|
||||
|
||||
def script_audibility_mode(self, _):
|
||||
self.__set_slider_mode("audibility")
|
||||
def script_slider_mode(self, gesture):
|
||||
if gesture.displayName.endswith("g"):
|
||||
self.controller.ctx.slider_mode = "gain"
|
||||
elif gesture.displayName.endswith("c"):
|
||||
self.controller.ctx.slider_mode = "comp"
|
||||
elif gesture.displayName.endswith("t"):
|
||||
self.controller.ctx.slider_mode = "gate"
|
||||
elif gesture.displayName.endswith("d"):
|
||||
self.controller.ctx.slider_mode = "denoiser"
|
||||
elif gesture.displayName.endswith("a"):
|
||||
self.controller.ctx.slider_mode = "audibility"
|
||||
ui.message(f"{self.controller.ctx.slider_mode} mode enabled")
|
||||
|
||||
### BOOLEAN PARAMETERS ###
|
||||
|
||||
@ -95,34 +89,28 @@ class CommandsMixin:
|
||||
self.controller.ctx.set_bool(output, val)
|
||||
ui.message("on" if val else "off")
|
||||
|
||||
### CONTROL SLIDERS ###
|
||||
### SLIDER MODES ###
|
||||
|
||||
def script_slider_increase_by_point_one(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) + 0.1
|
||||
def script_slider_increase(self, gesture):
|
||||
op = util.remove_prefix(gesture.displayName, "kb:NVDA+shift+")
|
||||
if op.startswith("alt"):
|
||||
offset = 0.1
|
||||
elif op.startswith("ctrl"):
|
||||
offset = 3
|
||||
else:
|
||||
offset = 1
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) + offset
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
||||
def script_slider_decrease_by_point_one(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) - 0.1
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
||||
def script_slider_increase_by_one(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) + 1
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
||||
def script_slider_decrease_by_one(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) - 1
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
||||
def script_slider_increase_by_three(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) + 3
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
||||
def script_slider_decrease_by_three(self, gesture):
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) - 3
|
||||
def script_slider_decrease(self, gesture):
|
||||
op = util.remove_prefix(gesture.displayName, "kb:NVDA+shift+")
|
||||
if op.startswith("alt"):
|
||||
offset = 0.1
|
||||
elif op.startswith("ctrl"):
|
||||
offset = 3
|
||||
else:
|
||||
offset = 1
|
||||
val = self.controller.ctx.get_float(self.controller.ctx.slider_mode) - offset
|
||||
self.controller.ctx.set_float(self.controller.ctx.slider_mode, val)
|
||||
ui.message(str(round(val, 1)))
|
||||
|
@ -1,20 +0,0 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def config_from_json():
|
||||
pn = Path.home() / "Documents" / "Voicemeeter" / "nvda_settings.json"
|
||||
data = None
|
||||
if pn.exists():
|
||||
with open(pn, "r") as f:
|
||||
data = json.load(f)
|
||||
return data or {}
|
||||
|
||||
|
||||
__config = config_from_json()
|
||||
|
||||
|
||||
def get(name, default=None):
|
||||
if name in __config:
|
||||
return __config[name]
|
||||
return default
|
@ -1,7 +1,3 @@
|
||||
from . import config
|
||||
from .kinds import request_kind_map
|
||||
|
||||
|
||||
def remove_prefix(input_string, prefix):
|
||||
if prefix and input_string.startswith(prefix):
|
||||
return input_string[len(prefix) :]
|
||||
@ -12,40 +8,3 @@ def remove_suffix(input_string, suffix):
|
||||
if suffix and input_string.endswith(suffix):
|
||||
return input_string[: -len(suffix)]
|
||||
return input_string
|
||||
|
||||
|
||||
def _make_gestures(kind_id):
|
||||
kind = request_kind_map(kind_id)
|
||||
defaults = {
|
||||
"kb:NVDA+alt+s": "strip_mode",
|
||||
"kb:NVDA+alt+b": "bus_mode",
|
||||
"kb:NVDA+alt+g": "gain_mode",
|
||||
"kb:NVDA+alt+c": "comp_mode",
|
||||
"kb:NVDA+alt+t": "gate_mode",
|
||||
"kb:NVDA+alt+d": "denoiser_mode",
|
||||
"kb:NVDA+alt+a": "audibility_mode",
|
||||
"kb:NVDA+shift+q": "announce_controller",
|
||||
"kb:NVDA+shift+v": "announce_voicemeeter_version",
|
||||
"kb:NVDA+shift+o": "toggle_mono",
|
||||
"kb:NVDA+shift+s": "toggle_solo",
|
||||
"kb:NVDA+shift+m": "toggle_mute",
|
||||
"kb:NVDA+shift+c": "toggle_mc",
|
||||
"kb:NVDA+shift+k": "karaoke",
|
||||
"kb:NVDA+shift+upArrow": "slider_increase_by_point_one",
|
||||
"kb:NVDA+shift+downArrow": "slider_decrease_by_point_one",
|
||||
"kb:NVDA+shift+alt+upArrow": "slider_increase_by_one",
|
||||
"kb:NVDA+shift+alt+downArrow": "slider_decrease_by_one",
|
||||
"kb:NVDA+shift+control+upArrow": "slider_increase_by_three",
|
||||
"kb:NVDA+shift+control+downArrow": "slider_decrease_by_three",
|
||||
}
|
||||
for i in range(1, kind.num_strip + 1):
|
||||
defaults[f"kb:NVDA+alt+{i}"] = "index"
|
||||
for i in range(1, kind.phys_out + kind.virt_out + 1):
|
||||
defaults[f"kb:NVDA+shift+{i}"] = "bus_assignment"
|
||||
abc = config.get("keybinds")
|
||||
if abc:
|
||||
overrides = {f"kb:{remove_prefix(k, 'kb:')}": v for k, v in abc.items()}
|
||||
matching_values = set(defaults.values()).intersection(set(overrides.values()))
|
||||
defaults = {k: v for k, v in defaults.items() if v not in matching_values}
|
||||
return {**defaults, **overrides}
|
||||
return defaults
|
||||
|
@ -5,7 +5,7 @@ param(
|
||||
function Copy-FilestoScratchpad {
|
||||
$source = Join-Path $PSScriptRoot "addon" "globalPlugins" "voicemeeter"
|
||||
$target = Join-Path $env:appdata "nvda" "scratchpad" "globalPlugins" "voicemeeter"
|
||||
Robocopy $source $target | Out-Null
|
||||
Robocopy $source $target /MIR /NFL /NDL /NJH /NJS /nc /ns /np
|
||||
}
|
||||
|
||||
function main {
|
||||
|
@ -28,7 +28,7 @@ addon_info = {
|
||||
The add-on requires Voicemeeter to be installed."""
|
||||
),
|
||||
# version
|
||||
"addon_version": "0.5",
|
||||
"addon_version": "0.4",
|
||||
# Author(s)
|
||||
"addon_author": "onyx-and-iris <code@onyxandiris.online>",
|
||||
# URL for the add-on documentation support
|
||||
|
Loading…
x
Reference in New Issue
Block a user