Exemplo n.º 1
0
 public static void InitVoices()
 {
     foreach (string voice in m_initVoices)
     {
         g_tts[voice] = new TTS(voice);
     }
 }
Exemplo n.º 2
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            Console.WriteLine("OnActivityResult {0}: {1}, {2}, {3}",
                              requestCode, resultCode, (int)resultCode, data);
            if (requestCode == TTS.TTS_REQUEST_DATA ||
                requestCode == TTS.TTS_INSTALLED_DATA ||
                requestCode == TTS.TTS_CHECK_DATA)
            {
                TTS.OnTTSResult(requestCode, resultCode, data);
            }
            else if (requestCode == STT.STT_REQUEST)
            {
                STT.SpeechRecognitionCompleted(resultCode, data);
            }
            else if (requestCode == InAppBilling.IAP_REQUEST)
            {
                InAppBilling.OnIAPCallback(requestCode, resultCode, data);
            }
            else if (requestCode == ImageEditor.SELECT_FROM_GALLERY ||
                     requestCode == ImageEditor.SELECT_FROM_CAMERA)
            {
                ImageEditor.OnActivityResult(requestCode, resultCode, data);
            }

            base.OnActivityResult(requestCode, resultCode, data);
        }
Exemplo n.º 3
0
        public static void OnTTSResult(int req, Result res, Intent data)
        {
            if (data == null)
            {
                TTS.InitVoices();
                return;
            }

            if (req == TTS_CHECK_DATA || req == TTS_INSTALLED_DATA)
            {
                IList <string> availableLanguages   = data.GetStringArrayListExtra(TextToSpeech.Engine.ExtraAvailableVoices);
                IList <string> unavailableLanguages = data.GetStringArrayListExtra(TextToSpeech.Engine.ExtraUnavailableVoices);

                Console.WriteLine("TTS {0} available: ", availableLanguages.Count);
                Array.ForEach <string>(availableLanguages.ToArray(), (av) => Console.Write("{0} ", av));
                Console.WriteLine("\nTTS {0} unavailable: ", unavailableLanguages.Count);
                Array.ForEach <string>(unavailableLanguages.ToArray(), (un) => Console.Write("{0} ", un));

                TTS.InitVoices();

                if (availableLanguages.Count <= 1 && m_context != null)
                {
                    Console.WriteLine("---> Performing TTS Install");
                    var installTTS = new Intent();
                    installTTS.SetAction(TextToSpeech.Engine.ActionInstallTtsData);
                    m_context.StartActivity(installTTS);
                }
            }
            if (req == TTS_REQUEST_DATA)
            {
                Console.WriteLine("---> TTS INSTALL Result {0} {1}", res, data);
            }
        }
Exemplo n.º 4
0
        public static TTS GetTTS(string voice)
        {
            TTS tts;

            if (g_tts.TryGetValue(voice, out tts))
            {
                return(tts);
            }
            tts          = new TTS(voice);
            g_tts[voice] = tts;
            return(tts);
        }
Exemplo n.º 5
0
        void InitTTS()
        {
            //Intent installedIntent = new Intent();
            //installedIntent.SetAction(TextToSpeech.Engine.ActionTtsDataInstalled);
            //StartActivityForResult(installedIntent, TTS_INSTALLED_DATA);

            Intent checkIntent = new Intent();

            checkIntent.SetAction(TextToSpeech.Engine.ActionCheckTtsData);
            StartActivityForResult(checkIntent, TTS.TTS_CHECK_DATA);

            TTS.Init(this);
        }