SpeechRecognizerAudioCaptureState enumeration
The SpeechRecognizerAudioCaptureState enumeration specifies the current state of an audio capture operation.
The SpeechRecognizerAudioCaptureState Enumeration has the following members.
Name | Description |
|---|---|
Cancelling | The SpeechRecognizer is cancelling the audio capture operation. |
Cancelled | The operation is cancelled. |
Complete | The audio capture operation is complete. |
Initializing | The SpeechRecognizer is initializing an audio capture session. |
Listening | The SpeechRecognizer is listening to audio input. |
Thinking | The SpeechRecognizer has finished listening and is now interpreting the input. |
Unknown | The audio capture process has entered an unknown state. |
Example
The following code example prints status information to a UI element named StatusBar.
var SR; function pageLoaded() { var credentials = new Bing.Speech.SpeechAuthorizationParameters(); credentials.clientId = "<YOUR CLIENT ID>"; credentials.clientSecret = "<YOUR CLIENT SECRET>"; SR = new Bing.Speech.SpeechRecognizer("en-US", credentials); SR.onaudiocapturestatechanged = SR_AudioCaptureStateChanged; } function SR_AudioCaptureStateChanged(sender, args) { var statusBar = document.getElementById("StatusBar"); switch (args.State) { case SpeechRecognizerAudioCaptureState.Canceled: statusBar.Text = "Operation cancelled."; break; case SpeechRecognizerAudioCaptureState.Cancelling: statusBar.Text = "Cancelling capture operation..."; break; case SpeechRecognizerAudioCaptureState.Complete: statusBar.Text = "Audio capture complete."; break; case SpeechRecognizerAudioCaptureState.Initializing: statusBar.Text = "Initializing audio capture..."; break; case SpeechRecognizerAudioCaptureState.Listening: statusBar.Text = "Listening..."; break; case SpeechRecognizerAudioCaptureState.Thinking: statusBar.Text = "Interpreting audio input..."; break; default: statusBar.Text = "Unknown capture state."; break; } }
Requirements
Minimum Supported Client | Windows 8 |
Required Extensions | Bing.Speech |
Namespace |