Пример #1
0
        public static void StartVoiceCapture(VoiceCaptureType capturetype)
        {
            IsRecording = true;                                                         /////////////////////////////////////////////////

            ForcedShortCaptureCtrl(true);                                               //보이스 트리거 끔
            AudIOData audIOData = audioIO.PlayMp3SoundAndRecordSound("ClovaSound.mp3"); //커맨드 캡쳐 시작

            if (audIOData.error == true)
            {
                Console.WriteLine("에러가 발생하였습니다");
                return;
            }

            Console.WriteLine("OnVoiceRecorded!");

            List <string> KeyWordList = new List <string>();

            if (capturetype == VoiceCaptureType.SearchYN)
            {
                KeyWordList = Commandmanager.YNCommandKeyWordList;
            }
            else if (capturetype == VoiceCaptureType.DefaultCapture)
            {
                KeyWordList = Commandmanager.CommandKeyWordList;
            }

            string speechV = speechRS.GoogleSpeechRecognition(audIOData.AudioStreamByte, KeyWordList);

            Console.WriteLine(speechV);

            IsRecording = false;/////////////////////////////////////////////////

            Commandmanager.AnalyzeCmdString(speechV, capturetype);
        }
Пример #2
0
        public static string VoiceCaptureGetString(VoiceCaptureType capturetype)
        {
            IsRecording = true;                                                         //////////////////////////////////////////////////

            ForcedShortCaptureCtrl(true);                                               //보이스 트리거 끔
            AudIOData audIOData = audioIO.PlayMp3SoundAndRecordSound("ClovaSound.mp3"); //커맨드 캡쳐 시작

            if (audIOData.error == true)
            {
                return(null);
            }

            Console.WriteLine("OnVoiceRecorded!");

            List <string> KeyWordList;

            if (capturetype == VoiceCaptureType.SearchYN)
            {
                KeyWordList = Commandmanager.YNCommandKeyWordList;
            }
            else
            {
                KeyWordList = Commandmanager.CommandKeyWordList;
            }

            string speechV = speechRS.GoogleSpeechRecognition(audIOData.AudioStreamByte, KeyWordList);

            Console.WriteLine(speechV);

            IsRecording = false;//////////////////////////////////////////////////

            return(speechV);
        }
Пример #3
0
        public void AnalyzeCmdString(string Voice2String, VoiceCaptureType capturetype)
        {
            string[] MulitiCmdArgs = SplitCmdline(Voice2String);

            foreach (var Arg in MulitiCmdArgs)
            {
                if (Arg.IndexOf("검색") > -1)
                {
                    if (Arg.Substring(0, 2) == "검색")
                    {
                        string SearchKey = Arg.Substring(2).Trim();
                        Console.WriteLine("|" + SearchKey + "|");
                        AddCmdOnQueue(new QueueObj(Arg, CmdMotion.SearchAndReadYN, 0, 0, SearchKey, null));
                    }
                    else
                    {
                        string SearchKey = "";
                        for (int i = 2; i < Arg.Length; i++)
                        {
                            int index2looking = Arg.Length - i;
                            if (Arg.Substring(index2looking, 2) == "검색")
                            {
                                SearchKey = Arg.Substring(0, index2looking).Trim();
                                break;
                            }
                        }
                        Console.WriteLine("|" + SearchKey + "|");
                        AddCmdOnQueue(new QueueObj(Arg, CmdMotion.SearchAndReadYN, 0, 0, SearchKey, null));
                    }
                }
                else if (Arg.IndexOf("읽어") > -1)
                {
                    if (Program.ChromeHandler.IsSearchTab() == true)
                    {
                        int Snumber = StringGetNumber(Arg);

                        if (Snumber == -1)//문자열 내에 아무런 숫자가 없다면
                        {
                            AddCmdOnQueue(new QueueObj(Arg, CmdMotion.ReadSearchList, 0, 0, null, null));
                        }
                        else
                        {
                            AddCmdOnQueue(new QueueObj(Arg, CmdMotion.ReadSearchList, Snumber, 0, null, null));
                        }
                    }
                    else
                    {
                        Program.GoogleTTS("유효하지 않은 탭입니다");
                    }
                }
                else if (Arg.IndexOf("열어") > -1)
                {
                }
            }
        }
Пример #4
0
 private static void AudioIO_OnShortVoiceRecorded(byte[] streamByte, VoiceCaptureType capturetype)//보이스 트리거/////////////////////시작점
 {
     if (FORCE_SHORTCAPTURE_LOCK == false)
     {
         Console.WriteLine("OnVoiceShortRecorded!");
         string speechV = speechRS.GoogleSpeechRecognition(streamByte, Commandmanager.TriggerKeyWordList);
         Console.WriteLine(speechV);
         if (Commandmanager.StringIsBiso(speechV))
         {
             StartVoiceCapture(VoiceCaptureType.DefaultCapture);//보이스 캡쳐 메소드
         }
     }
     else
     {
         audioIO.ShortCaptureCtrol(true);
     }
 }