AudioState Enum
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.
Contains a list of possible states for the audio input to a speech recognition engine.
public enum class AudioState
public enum AudioState
type AudioState =
Public Enum AudioState
- Inheritance
Fields
Silence | 1 | Receiving silence or non-speech background noise. |
Speech | 2 | Receiving speech input. |
Stopped | 0 | Not processing audio input. |
Examples
The following example demonstrates an event handler that handles the changing audio state of a speech recognizer.
private SpeechRecognitionEngine sre;
// Initializes the speech recognition engine.
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.
}
Remarks
You can obtain the audio input state of the speech recognition engine with the SpeechRecognitionEngine.AudioState and SpeechRecognizer.AudioState properties. The SpeechRecognitionEngine.AudioStateChanged and SpeechRecognizer.AudioStateChanged events are raised when the audio input state of a speech recognition engine changes.
Applies to
See also
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈