[6.4.0][Feat]新增语音打断的回调
This commit is contained in:
@@ -74,6 +74,9 @@ interface IMogoTTSCallback {
|
||||
default void onSpeakEnd( String speakText ) {
|
||||
}
|
||||
|
||||
default void onStopTts( String speakText ) {
|
||||
}
|
||||
|
||||
default void onSpeakError( String speakText, String errorMsg) {
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ class IFlyTekTts : IMogoTTS, InitListener {
|
||||
curTtsEntity?.let {
|
||||
val string = it.toString()
|
||||
if (speakVoiceMap.containsKey(string)) {
|
||||
speakVoiceMap.remove(string)
|
||||
speakVoiceMap.remove(string)?.onStopTts(string)
|
||||
}
|
||||
curTtsEntity = null
|
||||
}
|
||||
|
||||
@@ -357,7 +357,10 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack {
|
||||
|
||||
public void stopSpeakTts(String text) {
|
||||
if (mEngine != null && mHasAuth) {
|
||||
mSpeakVoiceMap.remove(text);
|
||||
IMogoTTSCallback callBack = mSpeakVoiceMap.remove(text);
|
||||
if (callBack != null) {
|
||||
callBack.onStopTts(curTtsContent);
|
||||
}
|
||||
curTtsContent = "";
|
||||
curTtsLevel = -1;
|
||||
mEngine.stop();
|
||||
@@ -366,7 +369,10 @@ public class PadTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack {
|
||||
|
||||
public void stopTts() {
|
||||
if (mEngine != null && mHasAuth) {
|
||||
mSpeakVoiceMap.remove(curTtsContent);
|
||||
IMogoTTSCallback callBack = mSpeakVoiceMap.remove(curTtsContent);
|
||||
if (callBack != null) {
|
||||
callBack.onStopTts(curTtsContent);
|
||||
}
|
||||
// tts过程中调用stop不会有回调事件
|
||||
curTtsContent = "";
|
||||
curTtsLevel = -1;
|
||||
|
||||
Reference in New Issue
Block a user