/// <summary> /// Kills the voice when its destroyed. /// /// preconditions: voice object exists. /// /// postconditions: any voice being played will be stopped. /// </summary> private void OnDestroy() { Debug.Log(string.Format("TextToSpeech::OnDestroy")); Debug.Assert(voice != null); voice.Pause(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Space)) { /*************************************************** * Userful resources for Country codes and SAPI XML fomat * https://msdn.microsoft.com/en-us/library/ms723602(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/ms717077(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/jj127898.aspx * /**************************************************/ voice.Volume = 100; // Volume (no xml) voice.Rate = 0; // Rate (no xml) voice.Speak("Fireball", SpeechVoiceSpeakFlags.SVSFlagsAsync | SpeechVoiceSpeakFlags.SVSFIsXML); /* * voice.Speak("<speak version='1.0' xmlns='http://www.w3.org/2001/10/synthesis' xml:lang='en-US'>" +"English One, two, three" +"<p xml:lang='it-IT'> Italiano uno, due, tre</p>" +"<p xml:lang='ja-JP'>日本語 一二三、終わります。 </p>" + "</speak>", + SpeechVoiceSpeakFlags.SVSFlagsAsync|SpeechVoiceSpeakFlags.SVSFIsXML); + + + voice.Speak("NOW XML SAPI TEST", SpeechVoiceSpeakFlags.SVSFlagsAsync); + + voice.Speak("Spelling: Chiaroscurist, <spell>Chiaroscurist.</spell>Normal Volume,<volume level='50'>Low volume</volume>", SpeechVoiceSpeakFlags.SVSFlagsAsync|SpeechVoiceSpeakFlags.SVSFIsXML); + voice.Speak("<lang langid='410'>Frase in italiano</lang>", SpeechVoiceSpeakFlags.SVSFlagsAsync|SpeechVoiceSpeakFlags.SVSFIsXML); + + + voice.Speak("ESTERNAL FILE READING TEST", SpeechVoiceSpeakFlags.SVSFlagsAsync); + + // voice.Speak(loadXMLStandalone ("builtIn.xml"), SpeechVoiceSpeakFlags.SVSFlagsAsync); + // voice.Speak(BuiltAsset, SpeechVoiceSpeakFlags.SVSFlagsAsync); + voice.Speak(loadXMLStandalone ("external.xml"), SpeechVoiceSpeakFlags.SVSFlagsAsync);//must in the resource folder after build + + voice.Speak("End of the test, enjoy this code", SpeechVoiceSpeakFlags.SVSFlagsAsync); */ } if (Input.GetKeyDown(KeyCode.P)) { voice.Pause(); } if (Input.GetKeyDown(KeyCode.R)) { voice.Resume(); } //TEST PER ANDROID /* if (Input.GetTouch) * { * * voice.Resume(); * }*/ }
private void Stop_BTN_Click(object sender, EventArgs e) { Stop_BTN.Visible = false; Start_BTN.Visible = true; sound.Pause(); status_label.Text = "Paused"; k = false; }
private void _PauseBtn_Click(object sender, EventArgs e) { // 読み上げ中かどうかを判断 if (sv.Status.RunningState == SpeechRunState.SRSEIsSpeaking) { // 読み上げ中なら停止 sv.Pause(); } else { sv.Resume(); } }
private void btnpasuse_Click(object sender, EventArgs e) { if ("暂停".Equals(btnpasuse.Text)) { btnpasuse.Text = "继续"; speech.Pause(); } else { btnpasuse.Text = "暂停"; speech.Resume(); } }
private void homeToolStripMenuItem_Click(object sender, EventArgs e) { needClose = true; Home ds = new Home(); sp.Stop(); vox.Pause(); vox = null; this.AddOwnedForm(ds); this.Hide(); this.Enabled = false; ds.Show(); }
// Update is called once per frame void Update() { if (intro) { StartCoroutine(startintro()); } if (intro1 && sm.task == 0) { StartCoroutine(startintro1()); } if (intro2 && sm.task == 0) { StartCoroutine(startintro2()); } if (intro3 && sm.task == 0) { StartCoroutine(startintro3()); } if (task1) { StartCoroutine(t1()); } if (task2) { StartCoroutine(t2()); } if (Input.GetKeyDown(KeyCode.P)) { voice.Pause(); } if (Input.GetKeyDown(KeyCode.R)) { voice.Resume(); } //TEST PER ANDROID /* if (Input.GetTouch) * { * * voice.Resume(); * }*/ }
public JsonResult GetVoice(string des) { string str = Strings.StrConv(des, Microsoft.VisualBasic.VbStrConv.SimplifiedChinese, 0x0804); SpeechLib.SpVoice voice = new SpVoice(); voice.Voice = voice.GetVoices(string.Empty, string.Empty).Item(0); if (des != "0") { voice.Speak(str, SpeechVoiceSpeakFlags.SVSFlagsAsync); } else { voice.Pause(); } return(Json("")); }
private void button1_Click(object sender, EventArgs e) { if (paused) { paused = false; speech.Resume(); timer1.Start(); button1.Text = "PAUSE"; } else { paused = true; speech.Pause(); timer1.Stop(); button1.Text = "UNPAUSE"; } }
private void button1_Click(object sender, EventArgs e) { if (button1.Text == "开始播放(暂停中)") { button1.Text = "暂停播放(播放中)"; lab_startime.Text = "开始时间:" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); PlayVoice(); timer1.Start(); _voice.Resume(); } else { button1.Text = "开始播放(暂停中)"; timer1.Stop(); _voice.Pause(); } }
void Update() { timer += Time.deltaTime; // voice.Volume = 100; voice.Volume = (int)Mathf.Round(70 + 30 * Mathf.Sin(timer/4)); if (Input.GetKeyDown("return")) { //int i = Random.Range(0, inputfield.words.Length); voice.Speak(dialogue, SpeechVoiceSpeakFlags.SVSFlagsAsync | SpeechVoiceSpeakFlags.SVSFIsXML); /*************************************************** * Userful resources for Country codes and SAPI XML fomat * https://msdn.microsoft.com/en-us/library/ms723602(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/ms717077(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/jj127898.aspx /**************************************************/ //voice.Rate = 0 ; // Rate (no xml) // tts.GetComponent<Text>().text += inputfield.words[i]; //tts.GetComponent<Text>().text += " "; } if (Input.GetKeyDown(KeyCode.P)) { voice.Pause(); } //TEST PER ANDROID /* if (Input.GetTouch) { voice.Resume(); }*/ }
//判断用户的点击是否是当前教程提示的步骤如果是则index++ public void isAccord(Operation.SChandle customOperation) { if (customOperation.h_id == ordersArry[index].o_handleId) { object lockThis = new object(); lock (lockThis) { index++; } if (voice != null) { Debug.Log("声音暂停"); voice.Pause(); teacherText.active = false; } //Stop(); } }
void Update() { if (Input.GetKeyDown(KeyCode.Q)) { //同步朗读(同步朗读时系统会停在这里,直到朗读完毕才会往下执行,建议使用异步朗读) voice.Speak("语音测试"); //异步朗读 voice.Speak(textfile.text, SpeechVoiceSpeakFlags.SVSFlagsAsync); } if (Input.GetKeyDown(KeyCode.W)) { //暂停使用该对象的所有朗读进程,同步朗读下无法使用该方法暂停 voice.Pause(); } if (Input.GetKeyDown(KeyCode.E)) { //恢复该对象所对应的被暂停的朗读进程 voice.Resume(); } }
private void timer3_Tick(object sender, EventArgs e) { int data_reade_int = Convert.ToInt32(port.ReadLine()); co_v.Text = listBox1.Items[listBox1.Items.Count - 1].ToString() + " ppm"; pw.co_v.Text = listBox1.Items[listBox1.Items.Count - 1].ToString() + " ppm"; p = Convert.ToInt32(listBox1.Items[listBox1.Items.Count - 1]); p = p / 10000; pw.label7.Text = p.ToString() + " %"; if (data_reade_int <= 500) { co_v.ForeColor = Color.Silver; label10.ForeColor = Color.Silver; voice.Pause(); pw.voice.Pause(); for (int i = 0; i < Application.OpenForms.Count; i++) { Form n = Application.OpenForms[i]; if (n.Name == "pollutionW") { n.Close(); } } } if (data_reade_int >= 501) { timer2.Start(); } }
// Update is called once per frame void Update() { if (Input.GetKeyDown("return")) { int i = Random.Range(0, inputfield.words.Length); voice.Speak(inputfield.words[i], SpeechVoiceSpeakFlags.SVSFlagsAsync | SpeechVoiceSpeakFlags.SVSFIsXML); /*************************************************** * Userful resources for Country codes and SAPI XML fomat * https://msdn.microsoft.com/en-us/library/ms723602(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/ms717077(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/windows/desktop/dd318693(v=vs.85).aspx * https://msdn.microsoft.com/en-us/library/jj127898.aspx * /**************************************************/ //voice.Rate = 0 ; // Rate (no xml) tts.GetComponent <Text>().text += inputfield.words[i]; tts.GetComponent <Text>().text += " "; } if (Input.GetKeyDown(KeyCode.P)) { voice.Pause(); } //TEST PER ANDROID /* if (Input.GetTouch) * { * * voice.Resume(); * }*/ }
public void pause() { voice = new SpVoice(); voice.Pause(); }
private void btnStop_Click(object sender, EventArgs e) { spVoice.Pause(); }
private void bunifuImageButton1_Click(object sender, EventArgs e) { voice.Pause(); this.Close(); }