/// <summary> /// 上传语音回调 /// </summary> /// <param name="code"></param> /// <param name="filepath"></param> /// <param name="fileid"></param> public void OnUploadReccordFileCompleteHandler(IGCloudVoice.GCloudVoiceCompleteCode code, string filepath, string fileid) { Debug.Log(string.Format(" GVoiceManger 上传语音回调 {0} / {1} / {2}", code, filepath, fileid)); if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_UPLOAD_RECORD_DONE) { if (m_GCloudVoiceMode != GCloudVoiceMode.Translation) { SetModel(GCloudVoiceMode.Translation); } int[] bytes = new int[1]; bytes[0] = 0; float[] seconds = new float[1]; seconds[0] = 0; m_voiceengine.GetFileParam(filepath, bytes, seconds); Debug.Log("GVoiceManger UploadRecordedFile seconds:" + seconds[0]); m_dicVoiceLength.Add(fileid, Mathf.CeilToInt(seconds[0])); int ret = m_voiceengine.SpeechToText(fileid); if (ret != 0) { SetRealTimeModel(); } } else if (code == IGCloudVoice.GCloudVoiceCompleteCode.GV_ON_UPLOAD_RECORD_ERROR) { SetRealTimeModel(); } }
public void Click_btnSpeechToText() { int err; if (m_fileid == null) { PrintLog("Speech to Text but fileid is null"); return; } err = m_voiceengine.SpeechToText(m_fileid, 0, 6000); PrintLog("SpeechToText with ret=" + err); }
public void SpeechToText(string fileid) { //Debug.LogError("do Speech to Text and fileid is "+ fileid); if (fileid != null) { if (mVoiceEngine != null) { mVoiceEngine.SpeechToText(fileid); } } else { Debug.LogError("Speech to Text but fileid is null"); } }