Partilhar via


SpeechRecognizer.AudioSignalProblemOccurred Evento

Definição

Ocorre quando o reconhecedor encontra um problema no sinal de áudio.

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) 

Tipo de evento

Exemplos

O exemplo a seguir define um manipulador de eventos que coleta informações sobre um AudioSignalProblemOccurred evento.

private SpeechRecognizer recognizer;  

// Initialize the speech recognition engine.  
private void Initialize()  
{  
  recognizer = new SpeechRecognizer();  

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

Comentários

Para obter qual problema ocorreu, use a AudioSignalProblem propriedade do associado AudioSignalProblemOccurredEventArgs.

Ao criar um delegado para um AudioSignalProblemOccurred evento, você identifica o método que manipulará o evento. Para associar o evento ao manipulador de eventos, adicione uma instância do delegado ao evento. O manipulador de eventos é chamado sempre que o evento ocorre, a menos que você remova o representante. Para obter mais informações sobre delegados do manipulador de eventos, consulte Eventos e delegados.

Aplica-se a

Confira também