SpeechRecognizer.AudioLevelUpdated Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the shared recognizer reports the level of its audio input.
public:
event EventHandler<System::Speech::Recognition::AudioLevelUpdatedEventArgs ^> ^ AudioLevelUpdated;
public event EventHandler<System.Speech.Recognition.AudioLevelUpdatedEventArgs> AudioLevelUpdated;
member this.AudioLevelUpdated : EventHandler<System.Speech.Recognition.AudioLevelUpdatedEventArgs>
Public Custom Event AudioLevelUpdated As EventHandler(Of AudioLevelUpdatedEventArgs)
Event Type
Examples
The following example adds a handler for the AudioLevelUpdated
event to a SpeechRecognizer object. The handler outputs the new audio level to the console.
private SpeechRecognizer recognizer;
// Initialize the SpeechRecognizer object.
private void Initialize()
{
recognizer = new SpeechRecognizer();
// Add an event handler for the AudioLevelUpdated event.
recognizer.AudioLevelUpdated +=
new EventHandler<AudioLevelUpdatedEventArgs>(recognizer_AudioLevelUpdated);
// Add other initialization code here.
}
// Write the audio level to the console when the AudioLevelUpdated event is raised.
void recognizer_AudioLevelUpdated(object sender, AudioLevelUpdatedEventArgs e)
{
Console.WriteLine("The audio level is now: {0}.", e.AudioLevel);
}
Remarks
The recognizer raises this event multiple times per second. The frequency with which the event is raised depends on the computer on which the application is running.
To get the audio level at the time of the event, use the AudioLevel property of the associated AudioLevelUpdatedEventArgs. To get the current audio level of the input to the recognizer, use the recognizer's AudioLevel property.
When you create a delegate for an AudioLevelUpdated
event, 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.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기