public void SaySinglePhrase(UniLangPhrase phrase, Action doneCallback=null) { var arrayOf1 = new[] { phrase }; CurMultiPhrasing = new MultiPhrasing(this, arrayOf1.AsEnumerable().GetEnumerator(), (fragment) => { if (fragment == null) // null means we are at the end doneCallback?.Invoke(); }); CurMultiPhrasing.Start(); }
/// <summary> /// 合成音声エンジンで日本語を話す人を探す /// </summary> /// <param name="voiceSpeeach">COMオブジェクト</param> private void SetJapaneseVoice(SpeechLib.SpVoice voiceSpeeach) { foreach (SpObjectToken voiceperson in voiceSpeeach.GetVoices()) { if ("411" == voiceperson.GetAttribute("Language")) { this.VoiceSpeeach.Voice = voiceperson; return; } } // 見つからないならエラー throw new InvalidOperationException( "日本語合成音声が利用できません。" + Environment.NewLine + "日本語合成音声 MSSpeech_TTS_ja-JP をインストールしてください。" ); }
private void FalseRecognitionEvent(int streamNumber, object streamPosition, SpeechLib.ISpeechRecoResult isrr) { Console.WriteLine("FALSE RECOG"); }
private void RecognitionEvent(int streamNumber, object streamPosition, SpeechLib.SpeechRecognitionType srt, SpeechLib.ISpeechRecoResult isr) { string strText = isr.PhraseInfo.GetText(0, -1, true); if (this.heaer.GetType().Name == "UcommHearerOne") { if (strText == "検索") { Console.WriteLine("One : " + strText); this.heaer = new UcommHearerTwoSearch(RecognitionEvent, FalseRecognitionEvent); } else if (strText == "メモ") { Console.WriteLine("One : " + strText); this.heaer = new UcommHearerTwoMemo(RecognitionEvent, FalseRecognitionEvent); } else if (strText == "終了") { Application.Exit(); } } else if (this.heaer.GetType().Name == "UcommHearerTwoSearch") { Console.WriteLine("TwoSearch : " + strText); if (strText == "検索") { } else if (strText == "履歴") { } else if (strText == "戻る") { this.heaer = new UcommHearerOne(RecognitionEvent, FalseRecognitionEvent); } } else if (this.heaer.GetType().Name == "UcommHearerTwoMemo") { Console.WriteLine("TwoMemo"); if (strText == "登録") { } else if (strText == "一覧") { } else if (strText == "登録") { } else if (strText == "戻る") { this.heaer = new UcommHearerOne(RecognitionEvent, FalseRecognitionEvent); } } }
public static void RecognitionEvent(int i, object o, SpeechLib.SpeechRecognitionType srt, SpeechLib.ISpeechRecoResult isrr) { string strText = isrr.PhraseInfo.GetText(0, -1, true); Console.WriteLine("recognized: " + strText); }
private void ContexRecognition(int iIndex, object obj, SpeechLib.SpeechRecognitionType type, SpeechLib.ISpeechRecoResult result) { if (SetMessage != null) { SetMessage(result.PhraseInfo.GetText(0, -1, true)); } }