this doesn't work yet. May never work lol.

This commit is contained in:
stormdragon2976
2023-06-12 00:20:34 -04:00
parent 0fc58d23cb
commit 91954beafc
4 changed files with 89 additions and 0 deletions

0
modules/__init__.py Normal file
View File

28
modules/custom_mumble.py Normal file
View File

@ -0,0 +1,28 @@
import pymumble_py3
import numpy as np
import threading
class CustomMumble(pymumble_py3.Mumble):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.audio_handler = None
self.is_running = False
def set_audio_handler(self, audio_handler):
self.audio_handler = audio_handler
def sound_received_handler(self, user, soundchunk):
if self.audio_handler is not None:
sound_array = np.frombuffer(soundchunk.pcm, dtype=np.int16)
num_channels = self.audio_handler.channels
sound_array = sound_array.reshape((-1, num_channels))
sound_float = sound_array.astype(np.float32) / 32767.0
self.audio_handler.write(sound_float)
def start(self):
self.is_running = True
threading.Thread(target=self.run).start()
def stop(self):
self.is_running = False