AI对话音量调整上报到IOT
authordxy <1731678236qq.com>
Thu, 21 Aug 2025 06:49:54 +0000 (14:49 +0800)
committerdxy <1731678236qq.com>
Thu, 21 Aug 2025 06:49:54 +0000 (14:49 +0800)
2.sdk/project/7PIN_1_5/sdk/services/microPython/ports/quectel/core/ai_VC.py

index 552993e..7e2e791 100644 (file)
@@ -846,7 +846,6 @@ class AI_dev(Abstract):
         EventMesh.subscribe("sys_up_cb",self.sys_up_cb)#系统唤醒后回调
         
         EventMesh.subscribe("GET_USB_STATE",self.get_usb_state)
-        EventMesh.subscribe("SET_TTS_VOLUME",self.set_tts_volume)
         EventMesh.subscribe("SET_SPEECH_RATE",self.set_speech_rate)
         
         print("AI_dev:2")
@@ -931,11 +930,7 @@ class AI_dev(Abstract):
                 #self.aud.play(1,1,'U:/static/R_CHARGE_OUT.mp3')
     def get_usb_state(self,event,msg):
         return self.usb_status
-    def set_tts_volume(self,event,msg):
-        EventMesh.publish("set_storage_config",["VC_TTS_volume",msg])#音量配置
-        self.VC_TTS_volume = msg
-        self.aud.setVolume(self.VC_TTS_volume //10)
-        pass
+    
     def set_speech_rate(self,event,msg):
         self.speech_rate = msg
         EventMesh.publish("set_storage_config",["speech_rate",self.speech_rate])
@@ -2398,7 +2393,8 @@ class AI_VC(Abstract):
         EventMesh.subscribe("audio_test_close", self.audio_test_close)
         EventMesh.subscribe("set_record_data_save_flag", self.set_record_data_save_flag)
         EventMesh.subscribe("set_VC_TTS_voice_type", self.set_VC_TTS_voice_type)
-        
+        EventMesh.subscribe("SET_TTS_VOLUME", self.set_tts_volume)
+        pass
         EventMesh.publish("close_led")
         self.dialog_attributes_provider =  EventMesh.publish("get_storage_config","dialog_attributes_provider")#智能体类型配置
         if self.dialog_attributes_provider == None:
@@ -2582,7 +2578,12 @@ class AI_VC(Abstract):
             self.audio_play_state = 0
             #EventMesh.publish("set_audio_state", 0)   
             print('audio-play finish.!!!!!!')
-
+    def set_tts_volume(self,event,msg):
+        EventMesh.publish("set_storage_config",["VC_TTS_volume",msg])#音量配置
+        self.VC_TTS_volume = msg
+        print("set_tts_volume:{} {}".format(self.VC_TTS_volume,msg))
+        self.aud.setVolume(self.VC_TTS_volume //10)
+        pass
     def AI_key_press(self, event=None, msg = None):#按键按下
         if self.voice_flag == 1: #语音留言模式
            # EventMesh.publish("stop_AI_record")