Share via


SPDUI_MicTraining

This variable defines the string for displaying a speech recognition engine's microphone training UI.

It is not a SAPI 5 compliance requirement for a speech recognition engine to implement UI for SPDUI_MicTraining.

When to Implement

When writing an SR engine for the desktop or a graphical environment, users may want to adapt the engine to the microphone before first use, or if recognition accuracy is poor. Microphone quality can greatly benefit recognition accuracy, even for a speaker-independent engine.

Use the Speech Control Panel to change settings for all installed SAPI 5-compliant SR Engines. Choose Configure Microphone on the SR tab to adapt the microphone and directly access each SR Engine's Microphone Training UI using SPDUI_MicTraining. If the SR Engine does not have support for training UI (see ISpTokenUI::IsUISupported), then Configure Microphone will be unavailable.

When to Access

The application could monitor the user's speech experience by recognition accuracy. If a user encounters too many false recognitions or recognition corrections, the application could ask the user if they would like to re-adapt the SR engine to their microphone (see ISpRecognizer::DisplayUI).

Also, an SR Engine can send a SPEI_REQUEST_UI event to the application if the engine determines that the input is too quiet or too loud and would like the user to perform microphone training. Typically the UI type will be SPDUI_MicTraining to ensure that the SR Engine is adapted to the current input audio settings.

#define SPDUI_MicTraining        L"MicTraining"

Example

The following code snippet illustrates the use of ISpTokenUI::IsUISupported using SPDUI_MicTraining.

HRESULT hr = S_OK;

// get the default speech recognizer token
hr = SpGetDefaultTokenFromCategoryId(SPCAT_RECOGNIZERS, &cpObjectToken);
// Check hr

// get the object token's UI
hr = cpObjectToken->QueryInterface(&cpTokenUI);
// Check hr

// check if the default speech recognizer has UI for performing Microphone Training 
hr = cpTokenUI->IsUISupported(SPDUI_MicTraining, NULL, NULL, NULL, &fSupported);
// Check hr

// if fSupported == TRUE, then default speech recognizer has UI for Microphone Training 
The following code snippet illustrates the use of ISpRecognizer::DisplayUI using SPDUI_MicTraining.

HRESULT hr = S_OK;

// display microphone training UI for the current recognizer
hr = cpRecognizer->DisplayUI(MY_HWND, MY_APP_MIC_TRAINING, SPDUI_MicTraining, NULL, NULL);
// Check hr

See Also

SAPI Global Variables

 Last updated on Saturday, April 10, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.