public RecognitionResult GetRecognitionResult() { if (Monitor.TryEnter(this)) // Enter synchronization block { RecognitionResult res = null; try { if (result != null) res = new RecognitionResult { word = result.word, likelihood = result.likelihood }; result = null; } finally { Monitor.Exit(this); } return res; } else return null; }
public void Update(GameTime gTime) { if (kinectSensor != null && speechEnabled) { RecognitionResult newCommand = cell.GetRecognitionResult(); if (newCommand != null && newCommand.likelihood > 0.65) { voiceCommand = newCommand; } } }
public void SetRecognitionResult(RecognitionResult newResult) { Monitor.Enter(this); try { result = newResult; } finally { Monitor.Exit(this); } }