Store capture and render device info for voice

This commit is contained in:
Salad Dais
2023-12-19 05:30:21 +00:00
parent 61820f1670
commit 29ab108764
2 changed files with 9 additions and 1 deletions

View File

@@ -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)

View File

@@ -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"]))