diff --git a/garmr.py b/garmr.py index 2a66995..1475d74 100755 --- a/garmr.py +++ b/garmr.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 - import pymumble_py3 from pymumble_py3.callbacks import PYMUMBLE_CLBK_SOUNDRECEIVED as PCS import sounddevice as sd @@ -10,10 +9,8 @@ import time from modules.custom_mumble import CustomMumble from setproctitle import setproctitle - setproctitle("Garmr") - # Connection details for Mumble server server = "mumble.example.com" # server address nick = "Garmr_Test" @@ -28,9 +25,6 @@ CHANNELS = 2 mumble = CustomMumble(server, nick, password=passwd, port=port) mumble.set_application_string("garmr") -# Set the sample rate and channels for Mumble -mumble.set_receive_sound((SAMPLE_RATE, CHANNELS)) - # Create a SoundDevice audio handler audio_handler = sd.OutputStream(samplerate=SAMPLE_RATE, channels=CHANNELS) @@ -39,10 +33,9 @@ mumble.set_audio_handler(audio_handler) # Set up the sound received callback mumble.callbacks.set_callback(PCS, mumble.sound_received_handler) - + # Start the Mumble client mumble.start() - mumble.is_ready() # Wait for the client to be ready # Keep the script running until interrupted @@ -52,9 +45,9 @@ try: except KeyboardInterrupt: pass finally: + # Stop the Mumble client + mumble.stop() + # Stop and close the SoundDevice stream audio_handler.stop() audio_handler.close() - - # Stop the Mumble client - mumble.stop()