AudioStateChangedEventArgs Class

AudioStateChangedEventArgs Class

Provides data for the AudioStateChanged event of the SpeechRecognitionEngine class.


Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

public class AudioStateChangedEventArgs : EventArgs

An instance of AudioStateChangedEventArgs is created when the SpeechRecognitionEngine object raises the AudioStateChanged event. To obtain the new state of audio input, access the AudioState property in the handler for the event.

You can obtain the current state of the audio input to the SpeechRecognitionEngine at any time using the AudioState property.

The following example demonstrates an event handler for handling the changing audio state of a speech recognition engine.

private SpeechRecognitionEngine sre;

// Initialize the SpeechRecognitionEngine object. 
private void Initialize()
  sre = new SpeechRecognitionEngine();

  // Add a handler for the AudioStateChanged event.
  sre.AudioStateChanged += new EventHandler<AudioStateChangedEventArgs>(sre_AudioStateChanged);

  // Add other initialization code here.

// Handle the AudioStateChanged event. 
void sre_AudioStateChanged(object sender, AudioStateChangedEventArgs e)
  AudioState newState = e.AudioState;

  // Handle event here.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
© 2015 Microsoft