Ejemplo n.º 1
0
 void Start()
 {
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
     Instance            = this;
     XfRecognizerListener.OngetResultStr += OnGetVoiceResult;
     IFlyVoice.initIFlyVoice();
 }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        if (speakButton != null)
        {
            speakButton.onClick.AddListener(delegate
            {
                IFlyVoice.startSpeaking("哆啦A梦,可爱的蓝胖子", "xiaoxin");
            });
        }

        //if (synthButton != null)
        //{
        //    synthButton.onClick.AddListener(delegate {
        //        //开始识别 普通话
        //        IFlyVoice.startRecognize();

        //        //关于选择不同识别语种
        //        //对于以上方法,在函数参数里面加一个语种参数即可,如:
        //       // IFlyVoice.startRecognize("cantonese");//粤语
        //                                              //////具体有哪些语种,我附在文章后面////////

        //        /// //////////////////////////以上方法不可同时执行///////////////////////////////
        //        /// //////////////////////////////////请选择一种////////////////////////////////////
        //    });
        //}
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        if (speakButton != null)
        {
            speakButton.onClick.AddListener(delegate
            {
                //以下两种方法可供选择
                //1.采用静态类调用
                //string text1 = "您好,感谢您对MemoryC的支持!";
                //IFlyVoice.startSpeaking(text1);
                ////2.采用MemoryC对string的扩展方法调用,推荐使用该方法
                //string text2 = "MemoryC祝您工作顺利!";
                //text2.speak();

                //关于选择不同人发音
                //对于以上任意一种方法,在函数参数里面加一个人名参数即可,如:
                IFlyVoice.startSpeaking("Hello world, I'm Henry.", "henry");
                //又如:
                //"我是小梅,感谢您阅读MemoryC的系列文章".speak("xiaomei");

                //////具体有哪些发音人,我附在文章后面////////

                /// //////////////////////////以上方法不可同时执行///////////////////////////////
                /// //////////////////////////////////请选择一种////////////////////////////////////
            });
        }


        if (synthButton != null)
        {
            synthButton.onClick.AddListener(delegate
            {
                //开始识别 普通话
                IFlyVoice.startRecognize();
            });
        }
        if (englishButton != null)
        {
            englishButton.onClick.AddListener(delegate
            {
                //关于选择不同识别语种
                //对于以上方法,在函数参数里面加一个语种参数即可,如:
                IFlyVoice.startRecognize("henry");//粤语
                //////具体有哪些语种,我附在文章后面////////

                /// //////////////////////////以上方法不可同时执行///////////////////////////////
                /// //////////////////////////////////请选择一种////////////////////////////////////
            });
        }
    }
Ejemplo n.º 4
0
    void Start()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        stringToVoiceButton.onClick.AddListener((() =>
        {
            string hello = "您好,感谢您对Mr.Ma的支持!";
            IFlyVoice.startSpeaking(hello);
            hello.ShowAsToast();
            voiceResultText.text += hello;
            Debug.Log(hello);
        }));

        voiceToStringButton.onClick.AddListener((() =>
        {
            IFlyVoice.startRecognize();
        }));
    }
Ejemplo n.º 5
0
    private IEnumerator Rec()
    {
        yield return(new WaitForSeconds(1f));

        IFlyVoice.startRecognize();
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Speak the specified text and voicer.
 /// </summary>
 /// <param name="text">Text.</param>
 /// <param name="voicer">Voicer.</param>
 public static void speak(this string text, string voicer = "xiaoyan")
 {
     IFlyVoice.startSpeaking(text, voicer);
 }