This commit is contained in:
@@ -30,15 +30,15 @@ class AudioStream:
|
||||
if _input:
|
||||
self.paInstance_kwargs['input_device_index'] = _input_device_index
|
||||
else:
|
||||
LOGGER.warning(f"[AudioStream.__init__]:\tInput was not enabled."
|
||||
f" Reinitialize with '_input=True'")
|
||||
LOGGER.warning("[AudioStream.__init__]:\tInput was not enabled."
|
||||
" Reinitialize with '_input=True'")
|
||||
|
||||
if _output_device_index:
|
||||
if _output:
|
||||
self.paInstance_kwargs['output_device_index'] = _output_device_index
|
||||
else:
|
||||
LOGGER.warning(f"[AudioStream.__init__]:\tOutput was not enabled."
|
||||
f" Reinitialize with '_output=True'")
|
||||
LOGGER.warning("[AudioStream.__init__]:\tOutput was not enabled."
|
||||
" Reinitialize with '_output=True'")
|
||||
|
||||
if _init_on_startup:
|
||||
# Init PyAudio instance
|
||||
@@ -59,15 +59,15 @@ class AudioStream:
|
||||
if self.paInstance_kwargs['input']:
|
||||
self.paInstance_kwargs['input_device_index'] = _new_input_device_index
|
||||
else:
|
||||
LOGGER.warning(f"[AudioStream.init_stream]:\tInput was not enabled when initialized."
|
||||
f" Reinitialize with '_input=True'")
|
||||
LOGGER.warning("[AudioStream.init_stream]:\tInput was not enabled when initialized."
|
||||
" Reinitialize with '_input=True'")
|
||||
|
||||
if _new_output_device_index:
|
||||
if self.paInstance_kwargs['output']:
|
||||
self.paInstance_kwargs['output_device_index'] = _new_output_device_index
|
||||
else:
|
||||
LOGGER.warning(f"[AudioStream.init_stream]:\tOutput was not enabled when initialized."
|
||||
f" Reinitialize with '_output=True'")
|
||||
LOGGER.warning("[AudioStream.init_stream]:\tOutput was not enabled when initialized."
|
||||
" Reinitialize with '_output=True'")
|
||||
|
||||
self.close_if_open()
|
||||
|
||||
@@ -80,7 +80,7 @@ class AudioStream:
|
||||
if self.stream.is_active():
|
||||
self.stream.stop_stream()
|
||||
self.stream.close()
|
||||
LOGGER.debug(f"[ReopenStream.close_if_open]:\t Stream was open; It was closed.")
|
||||
LOGGER.debug("[ReopenStream.close_if_open]:\t Stream was open; It was closed.")
|
||||
|
||||
def list_devices(self, _display_input_devices: bool = True, _display_output_devices: bool = True):
|
||||
LOGGER.info('Getting a list of the devices connected')
|
||||
@@ -126,7 +126,7 @@ class NoiseGate(AudioStream):
|
||||
def run(self) -> None:
|
||||
global voice_connection
|
||||
# Start the audio stream
|
||||
LOGGER.debug(f"Starting stream")
|
||||
LOGGER.debug("Starting stream")
|
||||
self.stream.start_stream()
|
||||
# Start the stream to discord
|
||||
self.core()
|
||||
@@ -139,15 +139,15 @@ class NoiseGate(AudioStream):
|
||||
time.sleep(.2)
|
||||
|
||||
if not voice_connection.is_playing():
|
||||
LOGGER.debug(f"Playing stream to discord")
|
||||
LOGGER.debug("Playing stream to discord")
|
||||
voice_connection.play(self.NGStream, after=self.core)
|
||||
|
||||
async def close(self):
|
||||
LOGGER.debug(f"Closing")
|
||||
LOGGER.debug("Closing")
|
||||
await voice_connection.disconnect()
|
||||
if self.stream.is_active:
|
||||
self.stream.stop_stream()
|
||||
LOGGER.debug(f"Stopping stream")
|
||||
LOGGER.debug("Stopping stream")
|
||||
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
@@ -155,7 +155,7 @@ class NoiseGateStream(discord.AudioSource):
|
||||
def __init__(self, _stream):
|
||||
super(NoiseGateStream, self).__init__()
|
||||
self.stream = _stream # The actual audio stream object
|
||||
self.NG_fadeout = 240/20 # Fadeout value used to hold the noisegate after de-triggering
|
||||
self.NG_fadeout = 240 / 20 # Fadeout value used to hold the noisegate after de-triggering
|
||||
self.NG_fadeout_count = 0 # A count set when the noisegate is triggered and was de-triggered
|
||||
self.process_set_count = 0 # Counts how many processes have been made
|
||||
|
||||
|
||||
Reference in New Issue
Block a user