SpeechDetectedEventArgs.AudioPosition 属性

定义

获取音频流中检测到语音的位置。

public:
 property TimeSpan AudioPosition { TimeSpan get(); };
public TimeSpan AudioPosition { get; }
member this.AudioPosition : TimeSpan
Public ReadOnly Property AudioPosition As TimeSpan

属性值

返回识别引擎的语音缓冲区中检测到的短语的位置。

示例

以下示例为或SpeechRecognizer.SpeechDetected事件创建处理程序SpeechRecognitionEngine.SpeechDetected。 每次检测到语音并显示状态信息(包括音频位置)时,处理程序都会初始化显示。

_recognizer.SpeechDetected +=  
  delegate(object sender, SpeechDetectedEventArgs eventArgs)   
  {  

    // Clear previous recognition information.  
    _audioDeviceStatusLabel.Enabled = true;  
    _audioDeviceStatusLabel.Visible = true;  
    Utils.DisplayAudioInputFormat(_audioStateLabel, _recognizer);  
    Utils.DisplayRecognizerState(_recognizerStateLabel, _recognizer.State);  
    Utils.DisplaySpeechDetected(_speechDetectedLabel, eventArgs.AudioPosition);  
  };  

适用于

另请参阅