From 29ab1087643167a42eb6436e4e6f8ec4da55af33 Mon Sep 17 00:00:00 2001 From: Salad Dais Date: Tue, 19 Dec 2023 05:30:21 +0000 Subject: [PATCH] Store capture and render device info for voice --- hippolyzer/lib/voice/client.py | 8 +++++++- voice_examples/hello_voice.py | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hippolyzer/lib/voice/client.py b/hippolyzer/lib/voice/client.py index 2173448..8da97cd 100644 --- a/hippolyzer/lib/voice/client.py +++ b/hippolyzer/lib/voice/client.py @@ -40,7 +40,7 @@ def vivox_to_uuid(val): class VoiceClient: - SERVER_URL = "http://www.bhr.vivox.com/api2/" # noqa + SERVER_URL = "https://www.bhr.vivox.com/api2/" def __init__(self, host, port): self._host = host @@ -56,6 +56,8 @@ class VoiceClient: self.participant_removed = Event() self.capture_devices_received = Event() self.render_devices_received = Event() + self.render_devices = {} + self.capture_devices = {} self._pending_req_futures: dict[str, asyncio.Future] = {} @@ -162,9 +164,13 @@ class VoiceClient: # TODO: Move all this extra crap out of here devices = (await self.send_message("Aux.GetCaptureDevices.1", {}))["Results"] self.capture_devices_received.notify(devices) + self.capture_devices.clear() + self.capture_devices.update(devices) devices = (await self.send_message("Aux.GetRenderDevices.1", {}))["Results"] self.render_devices_received.notify(devices) + self.render_devices.clear() + self.render_devices.update(devices) await self.set_speakers_muted(False) await self.set_speaker_volume(62) diff --git a/voice_examples/hello_voice.py b/voice_examples/hello_voice.py index 075b6b3..9e706f8 100644 --- a/voice_examples/hello_voice.py +++ b/voice_examples/hello_voice.py @@ -16,6 +16,8 @@ VOICE_PATH = os.environ["SLVOICE_PATH"] async def amain(): client = await VoiceClient.simple_init(VOICE_PATH) async with aclosing(client): + print("Capture Devices:", client.capture_devices) + print("Render Devices:", client.render_devices) await client.set_mic_muted(True) await client.set_mic_volume(60) print(await client.login(os.environ["SLVOICE_USERNAME"], os.environ["SLVOICE_PASSWORD"]))