From c308a8fd0720be114b5d3405073c384503d85474 Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Fri, 25 Aug 2023 18:52:26 +0100 Subject: [PATCH] query values dict instead of making redundant api calls --- src/nvda_voicemeeter/window.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nvda_voicemeeter/window.py b/src/nvda_voicemeeter/window.py index 5d65758..587ae24 100644 --- a/src/nvda_voicemeeter/window.py +++ b/src/nvda_voicemeeter/window.py @@ -95,10 +95,11 @@ class Window(psg.Window): channel = ("left", "right")[int(channel)] self.nvda.speak(f"Patch ASIO {in_num} {channel} set to {val}") case [["ASIO", "CHECKBOX"], [in_num, channel], ["FOCUS", "IN"]]: + val = values[f"ASIO CHECKBOX||{in_num} {channel}"] index = get_asio_checkbox_index(int(channel), int(in_num[-1])) channel = ("left", "right")[int(channel)] num = int(in_num[-1]) - self.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {self.vm.patch.asio[index].get()}") + self.nvda.speak(f"Patch ASIO inputs to strips IN#{num} {channel} {val}") case [["INSERT", "CHECKBOX"], [in_num, channel]]: index = get_insert_checkbox_index( self.kind, @@ -116,11 +117,10 @@ class Window(psg.Window): int(channel), int(in_num[-1]), ) + val = values[f"INSERT CHECKBOX||{in_num} {channel}"] channel = _patch_insert_channels[int(channel)] num = int(in_num[-1]) - self.nvda.speak( - f"Patch INSERT IN#{num} {channel} {'on' if self.vm.patch.insert[index].on else 'off'}" - ) + self.nvda.speak(f"Patch INSERT IN#{num} {channel} {'on' if val else 'off'}") case _: self.logger.error(f"Unknown event {event}") self.logger.debug(parsed_cmd)