[6.8.0][Feat]新增车外语音播报功能
This commit is contained in:
@@ -5,6 +5,7 @@ import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.support.device.DevicesManager;
|
||||
import com.mogo.tts.base.IGlobalTtsCallback;
|
||||
import com.mogo.tts.base.IMogoTTS;
|
||||
import com.mogo.tts.base.IMogoTTSCallback;
|
||||
@@ -61,14 +62,17 @@ public class AIAssist {
|
||||
Class<?> clazz3 = null;
|
||||
try {
|
||||
clazz1 = Class.forName("com.mogo.tts.pad.PadTTS");
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
try {
|
||||
clazz2 = Class.forName("com.mogo.tts.iflytek.IFlyTekTts");
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
clazz3 = Class.forName("com.mogo.tts.pad.ZhiTTS");
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
if (clazz1 != null) {
|
||||
mTTS = (IMogoTTS) clazz1.getConstructor().newInstance();
|
||||
@@ -141,6 +145,7 @@ public class AIAssist {
|
||||
|
||||
/**
|
||||
* 等级由低到高为0、1、2、3,分别对应p3、p2、p1、p0
|
||||
*
|
||||
* @param text
|
||||
* @param level
|
||||
*/
|
||||
@@ -152,8 +157,9 @@ public class AIAssist {
|
||||
|
||||
/**
|
||||
* 支持多语言的Tts
|
||||
*
|
||||
* @param ttsEntity: 多语言Entity
|
||||
* @param level: 等级由低到高为0、1、2、3,分别对应p3、p2、p1、p0
|
||||
* @param level: 等级由低到高为0、1、2、3,分别对应p3、p2、p1、p0
|
||||
* @param callback
|
||||
*/
|
||||
public void speakMultiLangTTSWithLevel(MultiLangTtsEntity ttsEntity, int level, IMogoTTSCallback callback) {
|
||||
@@ -191,6 +197,26 @@ public class AIAssist {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* text:语音播报内容,level:播报级别,withOutside:true代表两个一起播,反之则只播车内
|
||||
*/
|
||||
public void speakTTSVoiceWithLevel(String text, int level, IMogoTTSCallback callBack, boolean withOutside) {
|
||||
if (withOutside) {
|
||||
DevicesManager.INSTANCE.speechCx830seBroadcast(text);
|
||||
speakTTSVoiceWithLevel(text, level, callBack);
|
||||
} else {
|
||||
speakTTSVoiceWithLevel(text, level, callBack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param text:只播报车外的语音
|
||||
*/
|
||||
public void playVoiceOutside(String text) {
|
||||
DevicesManager.INSTANCE.speechCx830seBroadcast(text);
|
||||
}
|
||||
|
||||
public void stopSpeakTts(String tts) {
|
||||
if (mTTS != null) {
|
||||
mTTS.stopSpeakTts(tts);
|
||||
|
||||
Reference in New Issue
Block a user