/// <summary> /// 合成数据和进度的回调接口,分多次回调。 注意:progress表示进度,与播放到哪个字无关 /// </summary> /// <param name="json">utteranceId和字符串以及进度progress</param> public void onSynthesizeDataArrived(string json) { BDTts value = JsonConvert.DeserializeObject <BDTts>(json); if (mAudio != null) { mAudio.onSynthesizeDataArrived(value.utteranceId, Convert.FromBase64String(value.data), value.progress); } }
/// <summary> /// 当合成或者播放过程中出错时回调此接口 /// </summary> /// <param name="json">utteranceId和speechError(包含错误码和错误信息)</param> public void onError(string json) { BDTts value = JsonConvert.DeserializeObject <BDTts>(json); if (mAudio != null) { mAudio.onError(value.utteranceId); } }
/// <summary> /// 播放开始,每句播放开始都会回调 /// </summary> /// <param name="json">utteranceId</param> public void onSynthesizeStart(string json) { //Debug.Log("onSynthesizeStart: " + json); BDTts value = JsonConvert.DeserializeObject <BDTts>(json); if (mAudio != null) { mAudio.onSynthesizeStart(value.utteranceId); } }