Partager via


SPDUI_AudioVolume (SAPI 5.3)

Microsoft Speech API 5.3

SPDUI_RecoProfileProperties (C/C++)

SpeechRecoProfileProperties (Automation)

SPDUI_RecoProfileProperties defines the string for displaying the properties associated with a specific recognition profile.

It is not a SAPI 5 compliance requirement for a speech recognition (SR) engine to implement this UI for SPDUI_RecoProfileProperties.

For more information about Recognition Profiles, see the Object Tokens and Registry Settings White Paper.

When to Implement

When writing a speech engine for the desktop or a graphical environment, users can modify settings for specific run-time environments (e.g., mobile versus desktop, noisy versus quiet, fast versus slow computer, etc.).

Use Speech properties in Control Panel to change settings for all installed SAPI 5-compliant text-to-speech (TTS) and SR engines. Click Settings to change settings on a per-user/per-engine basis. Use SPDUI_RecoProfileProperties to directly access each Engine's Recognition Profile Settings UI. If the engine does not support the Recognition Profile Properties UI (see ISpTokenUI::IsUISupported), Settings will be unavailable.

When to Access

The application could display a button or menu item for environment profile settings that accessed SPDUI_RecoProfileProperties. If the application can be used in either noisy or quiet environments, the user could be prompted to update the current recognition profile to reflect their specific environment (see ISpRecognizer::DisplayUI. Changes made within the engine properties UI will affect only one engine, and will not affect other users.

For information on creating new recognition profiles, see the helper function SpCreateNewToken (by Category Id).

  
#define SPDUI_RecoProfileProperties        L"RecoProfileProperties"

Example

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

  
// Declare local identifiers:
HRESULT                    hr = S_OK;
CComPtr<ISpObjectToken>    cpObjectToken;
CComPtr<ISpTokenUI>        cpTokenUI;
BOOL                       fSupported;

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

if (SUCCEEDED(hr))
{
   // Get the object token's UI.
   hr = cpObjectToken->QueryInterface(&cpTokenUI;);
}

if (SUCCEEDED(hr))
{
   // Check if the default speech recognizer has
   // UI for its portion of the recognition profile.
   hr = cpTokenUI->IsUISupported(SPDUI_RecoProfileProperties, NULL, NULL, NULL, &fSupported;);
}

if (SUCCEEDED(hr))
{
   // If fSupported == TRUE, then the default speech recognizer
   // has UI for its portion of the recognition profile.
}

The following code snippet illustrates the use of ISpRecognizer::DisplayUI using SPDUI_RecoProfileProperties.

  
// Declare local identifiers:
HRESULT                    hr = S_OK;
CComPtr<ISpRecognizer>     cpRecognizer;
HWND                       hwndParent;

// Display recognition profile properties UI for the current recognizer.
hr = cpRecognizer->DisplayUI(hwndParent, L"My App's Caption", SPDUI_RecoProfileProperties, NULL, NULL);

if (SUCCEEDED(hr))
{
   // Do stuff here.
}