[Opt3.0]思必驰TTS兼容多语言的API

This commit is contained in:
chenfufeng
2023-03-03 17:02:51 +08:00
parent 460f9b3d36
commit 525d1827df

View File

@@ -29,6 +29,8 @@ import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.ToastUtils;
import com.mogo.tts.base.IMogoTTS;
import com.mogo.tts.base.IMogoTTSCallback;
import com.mogo.tts.base.LangTtsEntity;
import com.mogo.tts.base.LanguageType;
import com.mogo.tts.base.MultiLangTtsEntity;
import com.mogo.tts.base.PreemptType;
import com.zhidao.auto.platform.voice.VoiceClient;
@@ -443,9 +445,11 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@MainThread
public void speakTTSVoiceWithLevel(String text, int ttsLevel, IMogoTTSCallback callBack) {
if (mHasAuth && mEngine != null) {
mSpeakVoiceMap.put(text, callBack);
if (callBack != null) {
mSpeakVoiceMap.put(text, callBack);
}
speakTTSVoiceWithLevel(text, ttsLevel);
}
speakTTSVoiceWithLevel(text, ttsLevel);
}
// 降序插入Tts(目前Level0、1可排队)
@@ -508,7 +512,15 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsList
@Override
public void speakMultiLangTTSWithLevel(MultiLangTtsEntity ttsEntity, int level, IMogoTTSCallback callback) {
if (mHasAuth && mEngine != null) {
LangTtsEntity entity;
if ((entity = ttsEntity.ttsNext()) != null && entity.getLanguage() == LanguageType.CHINESE) {
if (callback != null) {
mSpeakVoiceMap.put(entity.getTtsContent(), callback);
}
speakTTSVoiceWithLevel(entity.getTtsContent(), level);
}
}
}
/**