changes to run when audio playback is muted
This commit is contained in:
@@ -420,6 +420,9 @@ class TranscriptionTeeClient:
|
|||||||
|
|
||||||
# read audio and create pyaudio stream
|
# read audio and create pyaudio stream
|
||||||
with wave.open(filename, "rb") as wavfile:
|
with wave.open(filename, "rb") as wavfile:
|
||||||
|
if self.mute_audio_playback:
|
||||||
|
self.stream = None
|
||||||
|
else:
|
||||||
self.stream = self.p.open(
|
self.stream = self.p.open(
|
||||||
format=self.p.get_format_from_width(wavfile.getsampwidth()),
|
format=self.p.get_format_from_width(wavfile.getsampwidth()),
|
||||||
channels=wavfile.getnchannels(),
|
channels=wavfile.getnchannels(),
|
||||||
@@ -428,6 +431,7 @@ class TranscriptionTeeClient:
|
|||||||
output=True,
|
output=True,
|
||||||
frames_per_buffer=self.chunk,
|
frames_per_buffer=self.chunk,
|
||||||
)
|
)
|
||||||
|
|
||||||
chunk_duration = self.chunk / float(wavfile.getframerate())
|
chunk_duration = self.chunk / float(wavfile.getframerate())
|
||||||
try:
|
try:
|
||||||
while any(client.recording for client in self.clients):
|
while any(client.recording for client in self.clients):
|
||||||
@@ -448,6 +452,7 @@ class TranscriptionTeeClient:
|
|||||||
client.wait_before_disconnect()
|
client.wait_before_disconnect()
|
||||||
self.multicast_packet(Client.END_OF_AUDIO.encode('utf-8'), True)
|
self.multicast_packet(Client.END_OF_AUDIO.encode('utf-8'), True)
|
||||||
self.write_all_clients_srt()
|
self.write_all_clients_srt()
|
||||||
|
if self.stream:
|
||||||
self.stream.close()
|
self.stream.close()
|
||||||
self.close_all_clients()
|
self.close_all_clients()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user