SpeechDetectedEventArgs.AudioPosition 屬性

定義

取得音訊資料流中偵測到語音的位置。

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

屬性值

傳回辨識引擎語音緩衝區內偵測到片語的位置。

範例

下列範例會建立 或 SpeechRecognitionEngine.SpeechDetected 事件的處理常式 SpeechRecognizer.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);  
  };  

適用於

另請參閱