AudioState 枚举

定义

音频输入到语音识别引擎包含可能状态列表。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
继承
AudioState

字段

Silence 1

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

Speech 2

接收语音输入。Receiving speech input.

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. 语音识别SpeechRecognizer.AudioStateChanged引擎的音频输入状态发生更改时,会引发和事件。SpeechRecognitionEngine.AudioStateChangedThe SpeechRecognitionEngine.AudioStateChanged and SpeechRecognizer.AudioStateChanged events are raised when the audio input state of a speech recognition engine changes.

适用于

另请参阅