#include "includes.h" OS_TID idTTSTask=0; U64 stkTTSTask[TTS_TASK_STK_SIZE]; OS_SEM TTSonSem; 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++; os_sem_send(&TTSonSem); } void LocalTTSHandle(void) { char buf[15]; //if(strcmp(sutProductPara.Keysound,"close")==0) return; if(ttsVoice.Update == 0) return; ModemSendAT("AT+LSHTTSSTP\r\n"); os_dly_wait(60); sutPocStatus.TTS=1; SpeakerEnable(); snprintf(buf, sizeof(buf), "AT+LSHTTS=%d,\"",ttsVoice.Languange); ModemSendAT(buf); if(ttsVoice.voiceStatic == NULL) ModemSendAT(ttsVoice.voice); else ModemSendAT(ttsVoice.voiceStatic); ModemSendAT("\"\r\n"); ttsVoice.Update=0; os_dly_wait(30); } __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(); } }