SpeechRecognitionEngine.AudioSignalProblemOccurred Evento

Definizione

Generato quando SpeechRecognitionEngine rileva un problema nel segnale audio.Raised when the SpeechRecognitionEngine detects a problem in the audio signal.

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) 

Esempi

Nell'esempio seguente viene definito un gestore eventi che raccoglie informazioni su un AudioSignalProblemOccurred evento.The following example defines an event handler that gathers information about an AudioSignalProblemOccurred event.

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.  
}  

Commenti

Per ottenere il problema che si è verificato AudioSignalProblem , utilizzare la proprietà AudioSignalProblemOccurredEventArgsdell'oggetto associato.To get which problem occurred, use the AudioSignalProblem property of the associated AudioSignalProblemOccurredEventArgs.

Quando si crea un delegato di AudioSignalProblemOccurred, si identifica il metodo con cui gestire l'evento.When you create an AudioSignalProblemOccurred delegate, you identify the method that will handle the event. Per associare l'evento al gestore eventi in uso, aggiungere all'evento un'istanza del delegato.To associate the event with your event handler, add an instance of the delegate to the event. Il gestore eventi viene chiamato ogni volta che si verifica l'evento, a meno che non venga rimosso il delegato.The event handler is called whenever the event occurs, unless you remove the delegate. Per ulteriori informazioni sui delegati del gestore eventi, vedere eventi e delegati.For more information about event-handler delegates, see Events and Delegates.

Si applica a

Vedi anche