BUGFIX noisegate
- Froze when leaving and joining - Add aarch64 option for opus
This commit is contained in:
16
NoiseGate.py
16
NoiseGate.py
@@ -1,3 +1,4 @@
|
||||
import threading
|
||||
import time
|
||||
|
||||
import numpy as np
|
||||
@@ -9,12 +10,14 @@ noise_gate_trigger = 0 # Set this value for the trigger on the noise-gate
|
||||
voice_connection = None
|
||||
audio_stream = None
|
||||
|
||||
|
||||
class NoiseGate(Thread):
|
||||
def __init__(self, trigger_value: int = 1000):
|
||||
global noise_gate_trigger
|
||||
super(NoiseGate, self).__init__()
|
||||
self.stream = None
|
||||
|
||||
self.stop_NG = threading.Event()
|
||||
self.NG_Started = threading.Event()
|
||||
noise_gate_trigger = trigger_value
|
||||
|
||||
def init_stream(self, num, _voice_connection, _audio_stream):
|
||||
@@ -24,7 +27,14 @@ class NoiseGate(Thread):
|
||||
audio_stream = _audio_stream
|
||||
|
||||
def run(self) -> None:
|
||||
self.stream.start()
|
||||
while not self.stop_NG.is_set():
|
||||
self.NG_Started.set()
|
||||
self.stream.start()
|
||||
|
||||
self.stream.stop()
|
||||
self.stream.close()
|
||||
self.NG_Started.clear()
|
||||
print('Thread #%s stopped' % self.ident)
|
||||
|
||||
|
||||
def stream_callback(indata, *args):
|
||||
@@ -40,4 +50,4 @@ def stream_callback(indata, *args):
|
||||
if voice_connection.is_playing():
|
||||
print("Noise Gate stopped")
|
||||
voice_connection.stop()
|
||||
# try disconnecting and reconnecting
|
||||
# try disconnecting and reconnecting
|
||||
Reference in New Issue
Block a user