Exemple #1
0
        /// <summary>
        /// Notification callback for getting messages from the clients.
        /// </summary>
        /// <param name="message"></param>
        public void Notify(string message)
        {
            ClientMessage settings = JsonConvert.DeserializeObject <ClientMessage>(message);

            KinectAudioHandler.Initialize(KinectHandler.Instance().SensorChooser.Kinect, settings.Contents);

            //TODO: You can add more code here for notifying more components using client-side messages properly.
        }
Exemple #2
0
        public static KinectAudioHandler Initialize(KinectSensor sensor, List <string> wordsToRecognize)
        {
            _kinectAudioHandler = new KinectAudioHandler(sensor);
            _kinectAudioHandler._speechRecognizer    = _kinectAudioHandler.CreateSpeechRecognizer(
                _kinectAudioHandler.WordsToRecognize = wordsToRecognize
                );

            //Start the sensor
            _kinectAudioHandler.CurrentSensor.Start();
            //Then run the start method to start streaming audio
            _kinectAudioHandler.Start();
            return(_kinectAudioHandler);
        }
Exemple #3
0
        /// <summary>
        /// Notification callback for getting messages from the clients.
        /// </summary>
        /// <param name="message"></param>
        public void Notify(string message)
        {
            ClientMessage clientMessage = JsonConvert.DeserializeObject <ClientMessage>(message);
            List <string> contents      = clientMessage.Contents;

            if (clientMessage.MessageType == "Speech")
            {
                KinectAudioHandler.Initialize(this.SensorChooser.Kinect, contents);
            }
            else if (clientMessage.MessageType == "Light")
            {
                try
                {
                    SensorsHandler.Instance().ChangeLight(Convert.ToBoolean(contents[0]), Convert.ToBoolean(contents[1]), Convert.ToBoolean(contents[2]));
                }
                catch (FormatException)
                {
                    Console.Error.WriteLine("Incorrect format from data received from the clients. Data are ignored.");
                }
            }

            //TODO: You can add more code here for notifying more components using client-side messages properly.
        }