From 7648b68b859532c63f44403567be9646dbfafdce Mon Sep 17 00:00:00 2001 From: onyx-and-iris Date: Mon, 11 Sep 2023 12:36:40 +0100 Subject: [PATCH] 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 --- pyproject.toml | 2 +- src/nvda_voicemeeter/builder.py | 4 +--- src/nvda_voicemeeter/util.py | 8 ++++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index de469d4..5e21e95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nvda_voicemeeter" -version = "0.1.3" +version = "0.1.4" description = "A Voicemeeter app compatible with NVDA" authors = [ { name = "onyx-and-iris", email = "code@onyxandiris.online" }, diff --git a/src/nvda_voicemeeter/builder.py b/src/nvda_voicemeeter/builder.py index cf7549b..a9e0d41 100644 --- a/src/nvda_voicemeeter/builder.py +++ b/src/nvda_voicemeeter/builder.py @@ -102,8 +102,6 @@ class Builder: """tab0 row1 represents hardware outs""" def add_physical_device_opts(layout): - devices = get_output_device_list(self.vm) - devices.append("- remove device selection -") if self.kind.name == "basic": num_outs = self.kind.phys_out + self.kind.virt_out else: @@ -113,7 +111,7 @@ class Builder: psg.ButtonMenu( f"A{i + 1}", size=(6, 3), - menu_def=["", devices], + menu_def=["", get_output_device_list(i, self.vm)], key=f"HARDWARE OUT||A{i + 1}", ) for i in range(num_outs) diff --git a/src/nvda_voicemeeter/util.py b/src/nvda_voicemeeter/util.py index ee2e957..f38a2bd 100644 --- a/src/nvda_voicemeeter/util.py +++ b/src/nvda_voicemeeter/util.py @@ -17,8 +17,12 @@ def get_input_device_list(vm) -> list: return ["{type}: {name}".format(**vm.device.input(i)) for i in range(vm.device.ins)] -def get_output_device_list(vm) -> list: - return ["{type}: {name}".format(**vm.device.output(i)) for i in range(vm.device.outs)] +def get_output_device_list(i, vm) -> list: + devices = ["{type}: {name}".format(**vm.device.output(j)) for j in range(vm.device.outs)] + 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: