Beispiel #1
0
        async Task speakTxt(string txt, string lang)
        {
            Debug.WriteLine("{0} speakTxt call play", this);
            //txt = "hello world";
            //IEnumerable<VoiceInformation> frenchVoices = from voice in SpeechSynthesizer.AllVoices
            //                                             where voice.Language == "fr-FR"
            //                                             select voice;
            //VoiceInformation voice;
            //bool ret = getVoice(out voice, lang);
            var synth = getSpeechSynth(lang);

            if (synth != null)
            {
                m_speakStat = speakStatus.called;
#if !once_synth
                lastTTSsynth = new SpeechSynthesizer();
#endif
                lastTTSstream = await synth.SynthesizeTextToStreamAsync(txt);
            }
            else
            {
#if false   //not show error msgbox in background
                MessageDialog msgbox = new MessageDialog(
                    string.Format("Not found {0} voice infomation. " +
                                  "Maybe {0} voice recognition was not installed!", lang));
                msgbox.Title = "Speak word error!";
                await msgbox.ShowAsync();
#endif
                //m_speakStat = speakStatus.end;
            }
        }
Beispiel #2
0
        void speakTxt()
        {
#if false
            if (m_speakStat != speakStatus.end)
            {
                Debug.WriteLine("{0} speakTxt m_speakStat {1}", this, m_speakStat.ToString());
                return;
            }
            m_speakStat = speakStatus.begin;
#endif
            //need disable all action
            var    items = getCurItems();
            var    item  = items[m_iCursor];
            string txt;
            string lang;
            item.getSpeakInfo(item.status, out txt, out lang);
#if test_study_page
            txt  = "hello world";
            lang = "en-US";
#endif
#if false
            speakTxt(txt, lang);
#else
            qryBgTask(new myBgTask
            {
                type = myBgTask.taskType.speek,
                data = new mySpeechQry {
                    txt = txt, lang = lang
                }
            });
#endif
        }