Example #1
0
        /// <summary>
        /// Initializes the keyword recognizer.
        /// Adds the keywords to the recognizer
        /// Sets the initialized flag to true.
        /// </summary>
        public void Init()
        {
            _keywordRecognizer = new UnityEngine.Windows.Speech.KeywordRecognizer(this.KeyWords.Keys.ToArray());
            _keywordRecognizer.OnPhraseRecognized += OnPhraseRecognized;
            _keywordRecognizer.Start();

            Initialized = true;
        }
Example #2
0
        /// <summary>
        /// Stops the key word recognizer
        /// Clears the key word recognizer from listeners
        /// Nullifies the keyword recognizer.
        /// Sets the initialized flag to FALSE
        /// </summary>
        public void Clear()
        {
            _keywordRecognizer.Stop();
            _keywordRecognizer.OnPhraseRecognized -= OnPhraseRecognized;
            _keywordRecognizer = null;

            Initialized = false;
        }