AudioLevelUpdatedEventArgs Class

Provides data for the AudioLevelUpdated event.


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

public class AudioLevelUpdatedEventArgs : EventArgs

An instance of AudioLevelUpdatedEventArgs is created when the SpeechRecognitionEngine object raises the SpeechRecognitionEngine.AudioLevelUpdated event. To obtain the new level of audio input, access the AudioLevel property in the handler for the event.

You can obtain the current level of the input to the SpeechRecognitionEngine at any time using the AudioLevel property.

The following example adds an event handler to a SpeechRecognitionEngine object. The handler outputs the new audio level to the console.

AudioLevelUpdatedEventArgs derives from EventArgs.

private SpeechRecognitionEngine sre;

// Initialize the SpeechRecognitionEngine object. 
private void Initialize()
  sre = new SpeechRecognitionEngine();
  // Add an event handler for the AudioLevelUpdated event.
  sre.AudioLevelUpdated += new EventHandler<AudioLevelUpdatedEventArgs>(sre_AudioLevelUpdated);

  // Add other initialization code here.

// Write the audio level to the console when the AudioLevelUpdated event is raised.
void sre_AudioLevelUpdated(object sender, AudioLevelUpdatedEventArgs e)
  Console.WriteLine("The audio level is now: {0}.", e.AudioLevel);

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