SpeechRecognitionEngine.AudioSignalProblemOccurred 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
在 SpeechRecognitionEngine 偵測到音訊訊號問題時引發。
public:
event EventHandler<System::Speech::Recognition::AudioSignalProblemOccurredEventArgs ^> ^ AudioSignalProblemOccurred;
public event EventHandler<System.Speech.Recognition.AudioSignalProblemOccurredEventArgs> AudioSignalProblemOccurred;
member this.AudioSignalProblemOccurred : EventHandler<System.Speech.Recognition.AudioSignalProblemOccurredEventArgs>
Public Custom Event AudioSignalProblemOccurred As EventHandler(Of AudioSignalProblemOccurredEventArgs)
事件類型
範例
下列範例會定義可收集事件相關資訊的 AudioSignalProblemOccurred 事件處理常式。
private SpeechRecognitionEngine recognizer;
// Initialize the speech recognition engine.
private void Initialize()
{
recognizer = new SpeechRecognitionEngine();
// Add a handler for the AudioSignalProblemOccurred event.
recognizer.AudioSignalProblemOccurred +=
new EventHandler<AudioSignalProblemOccurredEventArgs>(
recognizer_AudioSignalProblemOccurred);
}
// Gather information when the AudioSignalProblemOccurred event is raised.
void recognizer_AudioSignalProblemOccurred(object sender, AudioSignalProblemOccurredEventArgs e)
{
StringBuilder details = new StringBuilder();
details.AppendLine("Audio signal problem information:");
details.AppendFormat(
" Audio level: {0}" + Environment.NewLine +
" Audio position: {1}" + Environment.NewLine +
" Audio signal problem: {2}" + Environment.NewLine +
" Recognition engine audio position: {3}" + Environment.NewLine,
e.AudioLevel, e.AudioPosition, e.AudioSignalProblem,
e.recoEngineAudioPosition);
// Insert additional event handler code here.
}
備註
若要取得發生的問題,請使用 AudioSignalProblem 相關聯 AudioSignalProblemOccurredEventArgs 之 的 屬性。
當您建立 AudioSignalProblemOccurred 委派 (Delegate) 時,就可以識別即將處理此事件的方法。 若要使事件與您的事件處理常式產生關聯,請將委派的執行個體 (Instance) 加入至事件。 除非您移除委派,否則每當事件發生時就會呼叫事件處理常式。 如需事件處理常式委派的詳細資訊,請參閱 事件和委派。