| | |
| | | return;
|
| | | }
|
| | |
|
| | | StartRecord();
|
| | | overTime = DateTime.Now + new TimeSpan(SpeechTranslate.AUDIO_TIMELIMIT * TimeSpan.TicksPerSecond);
|
| | | AudioListener.volume = 0f;
|
| | | cacheCoroutine = StartCoroutine(Co_StartRecord());
|
| | | }
|
| | |
|
| | | public void OnPointerUp(PointerEventData eventData)
|
| | |
| | | }
|
| | |
|
| | | var seconds = (DateTime.Now - startRecordTime).TotalSeconds;
|
| | | if (seconds < 1.3f)
|
| | | {
|
| | | SysNotifyMgr.Instance.ShowTip("VoiceToolack");
|
| | | return;
|
| | | }
|
| | |
|
| | | var voiceInstanceId = VoiceWarehouse.SaveVoice(m_AudioSource.clip);
|
| | | if (voiceRecordSuccessEvent != null)
|
| | | {
|
| | | voiceRecordSuccessEvent(voiceInstanceId, (float)seconds - 0.3f);
|
| | | voiceRecordSuccessEvent(voiceInstanceId, (float)seconds);
|
| | | }
|
| | | VoiceTranslate(voiceInstanceId, samplesOfRecoding);
|
| | | }
|
| | | else if (cacheCoroutine != null)
|
| | | {
|
| | | StopCoroutine(cacheCoroutine);
|
| | | cacheCoroutine = null;
|
| | | WindowCenter.Instance.CloseImmediately<MonitorVoiceWin>();
|
| | | AudioListener.volume = 1f;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | WindowCenter.Instance.Open<MonitorVoiceWin>(true);
|
| | | }
|
| | |
|
| | | overTime = DateTime.Now + new TimeSpan(SpeechTranslate.AUDIO_TIMELIMIT * TimeSpan.TicksPerSecond);
|
| | | recoding = true;
|
| | | AudioListener.volume = 0f;
|
| | | m_AudioSource.clip = Microphone.Start(null, false, SpeechTranslate.AUDIO_TIMELIMIT, VoiceSettings.frequency);
|
| | | startRecordTime = DateTime.Now;
|
| | | cacheCoroutine = StartCoroutine(Co_StartRecord());
|
| | | m_AudioSource.Play();
|
| | | MonitorVoiceWin.audioSource = m_AudioSource;
|
| | | }
|
| | |
|
| | | IEnumerator Co_StartRecord()
|
| | | {
|
| | | yield return WaitingForSecondConst.WaitMS300;
|
| | | m_AudioSource.clip = Microphone.Start(null, false, SpeechTranslate.AUDIO_TIMELIMIT, VoiceSettings.frequency);
|
| | | MonitorVoiceWin.audioSource = m_AudioSource;
|
| | | m_AudioSource.Play();
|
| | | StartRecord();
|
| | | }
|
| | |
|
| | | private void StopRecord()
|