self.Close_flag =0 #=1时,连续对话播放完音频就退出
self.AI_alarm = _ai_alarm.AI_alarm()
self.buffer = bytearray(1024*8) #音频缓存区
+ self.tts_completed = 0#音频是否播放过
self.stop_tts = 0#音频是否播放完
#表情变化状态以及检索词
self.face_status = 0 # 0为正常,1为哭泣,2为愤怒,3为疑惑
EventMesh.subscribe("draw_handle", self.draw_handle)
EventMesh.subscribe("dmp_update", self.dmp_update)
EventMesh.subscribe("update_volume", self.update_volume)
- EventMesh.subscribe("AI_VC_Close", self.Close)
+ EventMesh.subscribe("AI_VC_Close", self.AI_VC_Close)
EventMesh.publish("close_led")
self.bot_name = "柒先生"
elif jsload_data["event"] == "tts.completed" :#tts结束
EventMesh.publish("open_led_green")#绿色
EventMesh.publish("publish_AI_btnInfo",{"func":self.VC_Play_Start})
+ self.tts_completed = 1
self.LocalRespondingEnded_timerout = 0
self.VC_state = VC_State_TTSEnd
pass
#EventMesh.publish("open_led_green")#绿色
self.LocalRespondingEnded_timerout = 3
self.VC_state = VC_State_End
- if self.stop_tts == 1:
+ if self.stop_tts == 1 and self.tts_completed == 1:#已经播放了音频并且音频停止了
self.AI_client_VC_end_tts()#音频结束
self.stop_tts = 0
+ self.tts_completed = 0
EventMesh.publish("send_device_VC_state")#上传VC状态
pass
elif jsload_data["event"] == "command" :#命令匹配
print("factory_timer_cb play......")
#self.aud.play(1,0,'U:/static/peizhichenggong.mp3')#切换成功
EventMesh.publish("audio_montage_play",["xinhaoruo1.mp3"])
-
+ def AI_VC_Close(self,event,msg):
+ EventMesh.publish("publish_AI_btnInfo",{"func":self.Close})
def Close(self):
self.VC_Thinking_timerout = 0
self.VC_satrt_flag = 0