[6.8.0][Feat]新增车外语音播报功能

This commit is contained in:
chenfufeng
2024-11-19 16:42:08 +08:00
parent 241ba6feb6
commit 6794d25894
4 changed files with 52 additions and 19 deletions

View File

@@ -1699,20 +1699,22 @@ class TravelRealityView @JvmOverloads constructor(
super.invokeOchInfo(ochInfo)
Log.d(TAG, "invokeOchInfo$ochInfo")
if (ochInfo.type == 0) {
val locList = ochInfo.latLonList
if (locList.isEmpty() || locList.size < 2) {
mStartLatLng = null
mEndLatLng = null
UiThreadHandler.post {
hideStartEndMarker()
val locationList = ochInfo.latLonList
locationList?.let { locList->
if (locList.isEmpty() || locList.size < 2) {
mStartLatLng = null
mEndLatLng = null
UiThreadHandler.post {
hideStartEndMarker()
}
} else {
// 设置开始结束Marker位置
mStartLatLng = LatLng(locList[0].latitude, locList[0].longitude)
mEndLatLng = LatLng(locList[1].latitude, locList[1].longitude)
}
if (!isPlayingAnim) {
drawStartAndEnd()
}
} else {
// 设置开始结束Marker位置
mStartLatLng = LatLng(locList[0].latitude, locList[0].longitude)
mEndLatLng = LatLng(locList[1].latitude, locList[1].longitude)
}
if (!isPlayingAnim) {
drawStartAndEnd()
}
}
}

View File

@@ -1,6 +1,10 @@
package com.mogo.eagle.core.data.och
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.data.map.SiteMarkerBean
// type 0-> 起终点坐标 坐标index 0 起点 坐标index 1 终点
data class OchInfo(var type: Int, var latLonList: List<MogoLocation>)
// type 1-> 起终点+站点
data class OchInfo(var type: Int, var latLonList: List<MogoLocation>?) {
var siteMarkerList: List<SiteMarkerBean>? = null// 起终点+站点
}

View File

@@ -62,12 +62,13 @@ dependencies {
api rootProject.ext.dependencies.ttsbase
api rootProject.ext.dependencies.mogo_core_data
api rootProject.ext.dependencies.mogo_core_network
api rootProject.ext.dependencies.serialport
} else {
api project(":foudations:mogo-aicloud-services-sdk")
api project(":tts:tts-base")
api project(':core:mogo-core-data')
api project(':core:mogo-core-network')
api project(":libraries:mogo-hardware-devices")
}
api 'com.mogo.cloud:countly-sdk:1.4.7.49.18-debug'

View File

@@ -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);