[event] fix bugs
This commit is contained in:
parent
cc5009f368
commit
4044e2b3e6
|
@ -386,8 +386,8 @@ class WebSocketClinet:
|
||||||
if not self.wakeup_event.is_set():
|
if not self.wakeup_event.is_set():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if self.listening_event.is_set():
|
if self.listening_event.is_set() or self.speaking_event.is_set():
|
||||||
print(f"{datetime.now()}: listening, skip setup web socket connection.")
|
print(f"{datetime.now()}: listening or speaking, skip setup web socket connection.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# 接收数据
|
# 接收数据
|
||||||
|
@ -399,11 +399,6 @@ class WebSocketClinet:
|
||||||
client.close_client()
|
client.close_client()
|
||||||
break
|
break
|
||||||
|
|
||||||
# if self.interrupt_event.is_set():
|
|
||||||
# self.listening_event.set()
|
|
||||||
# self.speaking_event.clear()
|
|
||||||
# break
|
|
||||||
|
|
||||||
response, data_type = client.receive_per_data()
|
response, data_type = client.receive_per_data()
|
||||||
if data_type == dict:
|
if data_type == dict:
|
||||||
print(f"{datetime.now()}: receive json data: {response}") # 打印接收到的消息
|
print(f"{datetime.now()}: receive json data: {response}") # 打印接收到的消息
|
||||||
|
@ -431,10 +426,6 @@ class WebSocketClinet:
|
||||||
self.speaking_event.set()
|
self.speaking_event.set()
|
||||||
self.audio_play_queue.put(('text_audio_data', response))
|
self.audio_play_queue.put(('text_audio_data', response))
|
||||||
|
|
||||||
elif data_type == bytes:
|
|
||||||
# 开始播放
|
|
||||||
print(f"{datetime.now()}: receive audio bytes")
|
|
||||||
self.audio_play_queue.put(('audio_bytes', response))
|
|
||||||
elif data_type == None:
|
elif data_type == None:
|
||||||
print(f"{datetime.now()}: receive None data, break loop.")
|
print(f"{datetime.now()}: receive None data, break loop.")
|
||||||
# 切换录音模式
|
# 切换录音模式
|
||||||
|
@ -540,7 +531,7 @@ class WebSocketClinet:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
def excute_process(self):
|
def excute_process(self):
|
||||||
'''
|
'''
|
||||||
Args:
|
Args:
|
||||||
|
@ -562,4 +553,5 @@ class WebSocketClinet:
|
||||||
self.audio_play_queue.put((instruct, content))
|
self.audio_play_queue.put((instruct, content))
|
||||||
|
|
||||||
self.speaker_active_set.clear()
|
self.speaker_active_set.clear()
|
||||||
|
"""
|
||||||
|
|
Loading…
Reference in New Issue