| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #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[15];
- // 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;
- // //time1
- // //os_dly_wait(30);
-
- 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+LSHTTSSTP\r\n");
- os_dly_wait(30); //85
- //播报最新TTS语音
- ttsVoice.Update=0;
- SpeakerCtrl(1);
- //noSpeakFlag=1;
- //SlwTrace(INF, "Ustart",1);
- //SlwTrace(INF,"TTS SEND",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();
- }
- }
|