/// <summary> /// Initializes a new instance of the <see cref="SpeechStreamHandler"/> class /// and associates it with a context that allows it to communicate with its owner. /// </summary> /// <param name="ownerContext"> /// An instance of <see cref="SensorStreamHandlerContext"/> class. /// </param> internal SpeechStreamHandler(SensorStreamHandlerContext ownerContext) { this.ownerContext = ownerContext; this.AddStreamConfiguration(SpeechEventCategory, new StreamConfiguration(this.GetProperties, this.SetProperty)); RecognizerInfo ri = GetKinectRecognizer(); if (ri != null) { this.speechEngine = new SpeechRecognitionEngine(ri.Id); if (this.speechEngine != null) { // disable speech engine adaptation feature this.speechEngine.UpdateRecognizerSetting("AdaptationOn", 0); this.speechEngine.UpdateRecognizerSetting("PersistedBackgroundAdaptation", 0); this.speechEngine.AudioStateChanged += this.AudioStateChanged; this.speechEngine.SpeechRecognitionRejected += this.SpeechRecognitionRejected; this.speechEngine.SpeechRecognized += this.SpeechRecognized; } } }
/// <summary> /// Creates a sensor stream handler object and associates it with a context that /// allows it to communicate with its owner. /// </summary> /// <param name="context"> /// An instance of <see cref="SensorStreamHandlerContext"/> class. /// </param> /// <returns> /// A new <see cref="ISensorStreamHandler"/> instance. /// </returns> public ISensorStreamHandler CreateHandler(SensorStreamHandlerContext context) { return(new SpeechStreamHandler(context)); }