SpeechRecognitionEngine..::..AudioSignalProblemOccurred Event |
SpeechRecognitionEngine Class Example See Also Send Feedback |
Raised when the SpeechRecognitionEngine detects a problem in the audio signal.
Namespace:
Microsoft.Speech.Recognition
Assembly:
Microsoft.Speech (in Microsoft.Speech.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Event AudioSignalProblemOccurred As EventHandler(Of AudioSignalProblemOccurredEventArgs) |
Visual Basic (Usage) |
---|
Dim instance As SpeechRecognitionEngine Dim handler As EventHandler(Of AudioSignalProblemOccurredEventArgs) AddHandler instance.AudioSignalProblemOccurred, handler |
C# |
---|
public event EventHandler<AudioSignalProblemOccurredEventArgs> AudioSignalProblemOccurred |
Remarks
To get which problem occurred, use the AudioSignalProblem property of the associated AudioSignalProblemOccurredEventArgs.
When you create an AudioSignalProblemOccurred delegate, you identify the method that will handle the event. To associate the event with your event handler, add an instance of the delegate to the event. The event handler is called whenever the event occurs, unless you remove the delegate. For more information about event-handler delegates, see Events and Delegates.
Examples
The following example defines an event handler that gathers information about an AudioSignalProblemOccurred event.
Copy Code | |
---|---|
private SpeechRecognitionEngine recognizer; // Initialize a SpeechRecognitionEngine object. 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. } |