Files
Hippolyzer/voice_examples/hello_voice.py

37 lines
1.0 KiB
Python
Raw Normal View History

2023-12-18 02:01:10 +00:00
"""
Connect to a voice session at 0, 0, 0 for 20 seconds, then exit.
"""
import asyncio
from contextlib import aclosing
import os
from hippolyzer.lib.base.datatypes import Vector3
from hippolyzer.lib.voice.client import VoiceClient
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)
2023-12-18 02:01:10 +00:00
await client.set_mic_muted(True)
await client.set_mic_volume(60)
print(await client.login(os.environ["SLVOICE_USERNAME"], os.environ["SLVOICE_PASSWORD"]))
await client.join_session(os.environ["SLVOICE_URI"], int(os.environ["SLVOICE_HANDLE"]))
2023-12-18 21:34:39 +00:00
await client.set_region_3d_pos(Vector3(0, 0, 0))
2023-12-18 02:01:10 +00:00
print(client.region_pos)
# leave running for 20 seconds, then exit
await asyncio.sleep(20.0)
print("Bye!")
if __name__ == "__main__":
asyncio.run(amain())