public void CopyFrom(SpeechControllerState other) { session = other.session; errorCode = other.errorCode; recognizedSpeech = other.recognizedSpeech; sequenceNumber = other.sequenceNumber; }
public SpeechControllerState(SpeechControllerState copyFrom) { session = copyFrom.session; errorCode = copyFrom.errorCode; recognizedSpeech = copyFrom.recognizedSpeech; sequenceNumber = copyFrom.sequenceNumber; }
// Process all events private void Process() { // check if controller has any new input SpeechControllerState currentState = SpeechControllerInput.shared.currentState; string recognizedText = currentState.recognizedSpeech; // check if we can use this text if (currentState.errorCode == SCErrorCode.no_error && recognizedText.Length > 0) { SpeechTextType textType = SpeechTextType.error; // send input to actors for handling bool eventIsHandled = false; // call all the handlers to handle the event foreach (ISpeechEventActionResponder aResponder in responders) { eventIsHandled = eventIsHandled || aResponder.handleEvent(recognizedText); } if (eventIsHandled) { textType = SpeechTextType.valid; controllerShouldBeActive = false; } // send output to display outputReceiver.logEvent(recognizedText, textType); } // check if controller needs to be started or stopped if (controllerShouldBeActive) { SpeechControllerInput.shared.controllerStart(); outputReceiver.appear(); } else { SpeechControllerInput.shared.controllerStop(); outputReceiver.disappear(); } }
/// Reads the controller's current state and stores it in outState. public void ReadState(SpeechControllerState outState) { updateState(); outState.CopyFrom(currentState); }