improve the feedback for some of the binds:

- solo + mc will give error warning if not currently using a Strip controller.
- karaoke and mc will give error warning if the Strip controller doesn't have the correct index.
- bus assignments will give error warning if not on a Strip controller.

mono now toggles for the Strip controller but rotates through modes for the Bus controller.
This commit is contained in:
onyx-and-iris 2026-03-19 05:33:16 +00:00
parent 84ee479bf1
commit 4c34028194
3 changed files with 61 additions and 17 deletions

View File

@ -56,14 +56,27 @@ class CommandsMixin:
def script_audibility_mode(self, _): def script_audibility_mode(self, _):
self.__set_slider_mode('audibility') self.__set_slider_mode('audibility')
# Mono is a special case because the parameter is a boolean for strips and an int for buses
def script_rotate_mono(self, _):
if isinstance(self.controller.ctx.strategy, context.StripStrategy):
val = not self.controller.ctx.get_bool('mono')
self.controller.ctx.set_bool('mono', val)
ui.message('on' if val else 'off')
else:
opts = ['off', 'on', 'stereo reverse']
val = self.controller.ctx.get_int('mono')
new_val = (val + 1) % len(opts)
self.controller.ctx.set_int('mono', new_val)
ui.message(opts[new_val])
### BOOLEAN PARAMETERS ### ### BOOLEAN PARAMETERS ###
def script_toggle_mono(self, _):
val = not self.controller.ctx.get_bool('mono')
self.controller.ctx.set_bool('mono', val)
ui.message('on' if val else 'off')
def script_toggle_solo(self, _): def script_toggle_solo(self, _):
if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
ui.message('Solo only available for strips')
return
val = not self.controller.ctx.get_bool('solo') val = not self.controller.ctx.get_bool('solo')
self.controller.ctx.set_bool('solo', val) self.controller.ctx.set_bool('solo', val)
ui.message('on' if val else 'off') ui.message('on' if val else 'off')
@ -74,19 +87,50 @@ class CommandsMixin:
ui.message('on' if val else 'off') ui.message('on' if val else 'off')
def script_toggle_mc(self, _): def script_toggle_mc(self, _):
if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
ui.message('MC only available for strips')
return
valid_indices = [self.kind.phys_in + 1]
match self.kind.name:
case 'potato':
valid_indices.append(self.kind.phys_in + self.kind.virt_in)
if self.controller.ctx.index + 1 not in valid_indices:
if len(valid_indices) == 1:
ui.message(f'MC only available for strip {valid_indices[0]} for Voicemeeter {self.kind}')
else:
ui.message(
f'MC only available for strips {valid_indices[0]} and {valid_indices[1]} for Voicemeeter {self.kind}'
)
return
val = not self.controller.ctx.get_bool('mc') val = not self.controller.ctx.get_bool('mc')
self.controller.ctx.set_bool('mc', val) self.controller.ctx.set_bool('mc', val)
ui.message('on' if val else 'off') ui.message('on' if val else 'off')
def script_karaoke(self, _): def script_karaoke(self, _):
if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
ui.message('Karaoke mode only available for strips')
return
valid_index = self.kind.phys_in + self.kind.virt_in - 1
# controller index is 0 based and the gesture display is 1 based, so subtract 1 from valid_index
if self.controller.ctx.index != valid_index - 1:
ui.message(f'Karaoke mode only available for strip {valid_index} for Voicemeeter {self.kind}')
return
opts = ['off', 'k m', 'k 1', 'k 2', 'k v'] opts = ['off', 'k m', 'k 1', 'k 2', 'k v']
val = self.controller.ctx.get_int('karaoke') + 1 val = self.controller.ctx.get_int('karaoke')
if val == len(opts): new_val = (val + 1) % len(opts)
val = 0 self.controller.ctx.set_int('karaoke', new_val)
self.controller.ctx.set_int('karaoke', val) ui.message(opts[new_val])
ui.message(opts[val])
def script_bus_assignment(self, gesture): def script_bus_assignment(self, gesture):
if not isinstance(self.controller.ctx.strategy, context.StripStrategy):
ui.message('Bus assignment only available for strips')
return
proposed = int(gesture.displayName[-1]) proposed = int(gesture.displayName[-1])
if proposed - 1 < self.kind.phys_out: if proposed - 1 < self.kind.phys_out:
output = f'A{proposed}' output = f'A{proposed}'

View File

@ -28,22 +28,22 @@ class Strategy(ABC):
self._slider_mode = val self._slider_mode = val
def get_bool(self, param: str) -> bool: def get_bool(self, param: str) -> bool:
return self._controller._get(f'{self.identifier}.{param}') == 1 return self._controller.get(f'{self.identifier}.{param}') == 1
def set_bool(self, param: str, val: bool): def set_bool(self, param: str, val: bool):
self._controller._set(f'{self.identifier}.{param}', 1 if val else 0) self._controller.set(f'{self.identifier}.{param}', 1 if val else 0)
def get_float(self, param: str) -> float: def get_float(self, param: str) -> float:
return round(self._controller._get(f'{self.identifier}.{param}'), 1) return round(self._controller.get(f'{self.identifier}.{param}'), 1)
def set_float(self, param: str, val: float): def set_float(self, param: str, val: float):
self._controller._set(f'{self.identifier}.{param}', val) self._controller.set(f'{self.identifier}.{param}', val)
def get_int(self, param: str) -> int: def get_int(self, param: str) -> int:
return int(self._controller._get(f'{self.identifier}.{param}')) return int(self._controller.get(f'{self.identifier}.{param}'))
def set_int(self, param: str, val: int): def set_int(self, param: str, val: int):
self._controller._set(f'{self.identifier}.{param}', val) self._controller.set(f'{self.identifier}.{param}', val)
class StripStrategy(Strategy): class StripStrategy(Strategy):

View File

@ -26,7 +26,7 @@ def _make_gestures(kind_id):
'kb:NVDA+alt+a': 'audibility_mode', 'kb:NVDA+alt+a': 'audibility_mode',
'kb:NVDA+shift+q': 'announce_controller', 'kb:NVDA+shift+q': 'announce_controller',
'kb:NVDA+shift+v': 'announce_voicemeeter_version', 'kb:NVDA+shift+v': 'announce_voicemeeter_version',
'kb:NVDA+shift+o': 'toggle_mono', 'kb:NVDA+shift+o': 'rotate_mono',
'kb:NVDA+shift+s': 'toggle_solo', 'kb:NVDA+shift+s': 'toggle_solo',
'kb:NVDA+shift+m': 'toggle_mute', 'kb:NVDA+shift+m': 'toggle_mute',
'kb:NVDA+shift+c': 'toggle_mc', 'kb:NVDA+shift+c': 'toggle_mc',