public void SetSpeaker(Speeker speeker) { if (DSpeeker.ContainsKey(speeker)) { _speeker = DSpeeker[speeker]; } }
public void SpeekerTest() { ManualResetEvent m = new ManualResetEvent(false); new Thread(() => { Application.Run(new Form()); m.Set(); }).Start(); for (int i = 0; i < 100; i++) { Speeker.SpeakAsynchSf("test " + i); } m.WaitOne(); }
public float Multi_Speak(string SpeekText, Speeker speeker) { SetSpeaker(speeker); MemoryStream memoryStream = m_XunFeiTemplate.SpeechSynthesis(SpeekText); AudioClip audioClip = ToAudioClip(memoryStream.ToArray()); if (audioClip == null) { return(-1); } m_AudioSource.Stop(); m_AudioSource.PlayOneShot(audioClip); return(audioClip.length); }
/// <summary> /// 设置发音人 /// </summary> /// <param name="speeker"></param> public void SetSpeaker(Speeker speeker) { m_XunFeiTemplate.SetSpeaker(speeker); }