Merge branch 'dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0' into dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0
This commit is contained in:
@@ -53,11 +53,24 @@ public class AIAssist {
|
||||
private AIAssist(Context context) {
|
||||
try {
|
||||
// 暂时换成反射,解决死锁问题
|
||||
// TODO:("支持切换思必驰和科大讯飞")
|
||||
Class<?> clazz = Class.forName("com.mogo.tts.pad.PadTTS");
|
||||
// Class<?> clazz = Class.forName("com.mogo.tts.iflytek.IFlyTekTts");
|
||||
mTTS = (IMogoTTS) clazz.getConstructor().newInstance();
|
||||
mTTS.init(context);
|
||||
Class<?> clazz1 = null;
|
||||
Class<?> clazz2 = null;
|
||||
try {
|
||||
clazz1 = Class.forName("com.mogo.tts.pad.PadTTS");
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
try {
|
||||
clazz2 = Class.forName("com.mogo.tts.iflytek.IFlyTekTts");
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
if (clazz1 != null) {
|
||||
mTTS = (IMogoTTS) clazz1.getConstructor().newInstance();
|
||||
} else if (clazz2 != null) {
|
||||
mTTS = (IMogoTTS) clazz2.getConstructor().newInstance();
|
||||
}
|
||||
if (mTTS != null) {
|
||||
mTTS.init(context);
|
||||
}
|
||||
// mTTS = (IMogoTTS) ARouter.getInstance().build(MogoTTSConstants.API_PATH).navigation(context.getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -104,7 +117,7 @@ public class AIAssist {
|
||||
*/
|
||||
public void speakTTSVoice(String text) {
|
||||
if (mTTS != null) {
|
||||
mTTS.speakTTSVoice(text);
|
||||
mTTS.speakTTSVoiceWithLevel(text, LEVEL0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user