AudioState AudioState AudioState AudioState Enum

定义

音频输入到语音识别引擎包含可能状态列表。Contains a list of possible states for the audio input to a speech recognition engine.

public enum class AudioState
public enum AudioState
type AudioState = 
Public Enum AudioState
继承

字段

Silence Silence Silence Silence 1

接收沈默或非语音背景噪音。Receiving silence or non-speech background noise.

Speech Speech Speech Speech 2

接收语音输入。Receiving speech input.

Stopped Stopped Stopped Stopped 0

没有处理音频输入。Not processing audio input.

示例

下面的示例演示的事件处理程序处理的语音识别器的音频状态变化。The following example demonstrates an event handler that handles the changing audio state of a speech recognizer.


private SpeechRecognitionEngine sre;  

// Initializes the speech recognition engine.  
private void Initialize()  
{  
  sre = new SpeechRecognitionEngine();  

  // Add a handler for the AudioStateChanged event.  
  sre.AudioStateChanged += new EventHandler<AudioStateChangedEventArgs>(sre_AudioStateChanged);  

  // Add other initialization code here.  
}  

  // Handle the AudioStateChanged event.  
  void sre_AudioStateChanged(object sender, AudioStateChangedEventArgs e)  
{  
  AudioState newState = e.AudioState;  

  // Handle event here.  
}  

注解

你可以获取与语音识别引擎的音频输入的状态SpeechRecognitionEngine.AudioStateSpeechRecognizer.AudioState属性。You can obtain the audio input state of the speech recognition engine with the SpeechRecognitionEngine.AudioState and SpeechRecognizer.AudioState properties. SpeechRecognitionEngine.AudioStateChangedSpeechRecognizer.AudioStateChanged音频输入的语音识别引擎更改状态时将引发事件。The SpeechRecognitionEngine.AudioStateChanged and SpeechRecognizer.AudioStateChanged events are raised when the audio input state of a speech recognition engine changes.

适用于

另请参阅