#include "includes.h" OS_TID idTTSTask=0; U64 stkTTSTask[TTS_TASK_STK_SIZE]; OS_SEM TTSonSem; static int VoiceTimeCnt=0; //if(os_time_get() < sucCt) continue; // sucCt = os_time_get()+100; TTS_DEF ttsVoice; void MeSpeak(ENCODE_DEF type, char *voice, unsigned char useLocalOrNot) { unsigned short len; len = strlen(voice); if(len > TTS_VOICE_SIZE) len = TTS_VOICE_SIZE; if(useLocalOrNot==0) { memcpy(ttsVoice.voice, voice, len); if(len < TTS_VOICE_SIZE) ttsVoice.voice[len]=0; ttsVoice.voiceStatic=NULL; }else{ ttsVoice.voiceStatic = voice; } ttsVoice.Languange = type; ttsVoice.Update++; VoiceTimeCnt = os_time_get()+40; // os_sem_send(&TTSonSem);//// } void LocalTTSHandle(void) { char buf[20]; //static unsigned int tickCnt; SUT_MODEM_AT_MSG *pMsg=&sutAtmPro; if(ttsVoice.Update == 0)return ; else { if( (os_time_get() > VoiceTimeCnt)) //如果当前没有语音在播报,则没有LTTS: END返回,则按300ms超时值算 { ModemSendAT("AT+LSHTTSTP\r\n"); os_dly_wait(30); //85 //播报最新TTS语音 ttsVoice.Update=0; SpeakerCtrl(1); //noSpeakFlag=1; snprintf(buf, sizeof(buf), "AT+LSHTTS=%d,\"",ttsVoice.Languange); //SlwTrace(INF,ttsVoice.voice,1); ModemSendAT(buf); if(ttsVoice.voiceStatic == NULL) ModemSendAT(ttsVoice.voice); else ModemSendAT(ttsVoice.voiceStatic); ModemSendAT("\"\r\n"); } } } __task void TTSTask(void) { memset((unsigned char *)&ttsVoice, 0, sizeof(TTS_DEF)); os_sem_init (&TTSonSem, 0); while(1) { os_sem_wait (&TTSonSem, 0xffff); LocalTTSHandle(); } }