private void InitValuesAfterRegisterEventHandlers() { Database = SettingKeys.Database.GetValue(); _speechSynthesizer = new Microsoft.Speech.Synthesis.SpeechSynthesizer(); try { _speechSynthesizer.SetOutputToDefaultAudioDevice(); TTSEnabled = true; } catch { if (MessageBox.Show( "오디오 장치가 연결되어 있지 않습니다.\r\n스피커를 연결 하셨습니까?", Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { _speechSynthesizer.SetOutputToDefaultAudioDevice(); TTSEnabled = true; } catch { } } } _prormptBuilder = new Microsoft.Speech.Synthesis.PromptBuilder(); SetTabPageTag(tpMonitoring, TabControlNames.Monitoring); SetTabPageTag(tpStatistics, TabControlNames.Statistics); SetTabPageTag(tpSettings, TabControlNames.Settings); tcMain.Controls.Remove(tpSettings); // 자동으로 안되서 수동일 일단 할당 // by GS_DEV\xyz37(김기원) in 2017년 12월 22일 금요일 12:33 //var tabPages = tcMain.Controls.Cast<TabPage>().ToList(); //var tabs = Enum.GetNames(typeof(TabControlNames)); //foreach (string tab in tabs) //{ // if (Enum.IsDefined(typeof(TabControlNames), tab) == true) // { // SetTabPageTag(tabPages, (TabControlNames)Enum.Parse(typeof(TabControlNames), tab)); // } //} //if (tcMain.TabPages.Count > 0) //{ // lbTitle.InvokeText(tcMain.TabPages[0].Text); //} }
private bool ConvertWithMicrosoftSpeech(string FileContent, int rate, CultureInfo ci, string tempPath) { Console.WriteLine("Converting with: Microsoft Speech"); try { using (Microsoft.Speech.Synthesis.SpeechSynthesizer ss = new Microsoft.Speech.Synthesis.SpeechSynthesizer()) { var prompt = new Microsoft.Speech.Synthesis.PromptBuilder(ci); prompt.AppendText(FileContent); ss.Rate = rate; ss.SetOutputToWaveFile(tempPath); ss.Speak(prompt); } return(true); } catch (Exception ex) { Console.WriteLine(ex); return(false); } }
private bool ConvertWithMicrosoftSpeech(string FileContent, int rate, CultureInfo ci, string tempPath) { Console.WriteLine("Converting with: Microsoft Speech"); try { using (Microsoft.Speech.Synthesis.SpeechSynthesizer ss = new Microsoft.Speech.Synthesis.SpeechSynthesizer()) { var prompt = new Microsoft.Speech.Synthesis.PromptBuilder(ci); prompt.AppendText(FileContent); ss.Rate = rate; ss.SetOutputToWaveFile(tempPath); ss.Speak(prompt); } return true; } catch (Exception ex) { Console.WriteLine(ex); return false; } }