ISpRecoContext::GetStatus (Windows Embedded CE 6.0)
1/6/2010
This method gets current status information associated with a speech recognition context. Status information includes data about the last SR engine-requested UI, audio signal status, and so on.
Syntax
HRESULT GetStatus(
SPRECOCONTEXTSTATUS* pStatus
);
Parameters
- pStatus
[out] Pointer to a SPRECOCONTEXTSTATUS structure containing status information about the speech recognition context.
Return Value
The following table shows the possible return values.
Value | Description |
---|---|
S_OK |
Function completed successfully. |
E_POINTER |
pStatus is invalid or bad. |
FAILED(hr) |
Appropriate error message. |
Remarks
A graphical application that is interested in SPEI_REQUEST_UI events from the SR engine can call ISpRecoContext::GetStatus, and check the szRequestTypeOfUI field to check the last requested UI-type. After the application has called ISpRecognizer::DisplayUI, the SR engine can clear the szRequestTypeOfUI field by calling ISpSREngineSite::AddEvent with a NULL UI-type.
An application can also periodically query the recognition context status to check the audio signal quality (see also SPINTERFERENCE) and respond appropriately. An application can help the user improve the audio signal quality by using the SR engine's microphone training UI (see SPDUI_MicTraining), or by prompting the user to modify their audio settings using the Speech Control Panel (see SPDUI_AudioProperties and SPDUI_AudioVolume).
Example
The following code snippet illustrates the use of this method for responding to SR engine UI requests.
HRESULT hr = S_OK;
// assume UI request [SPEI_REQUEST_UI] has been received
// check what kind of UI the SR Engine wants
hr = cpRecoContext->GetStatus(&contextStatus);
// Check hr
// get a reference to the SR Engine
hr = cpRecoContext->GetRecognizer(&cpRecognizer);
// Check hr
// sanity check that the UI type is supported
hr = cpRecognizer->IsUISupported(contextStatus.szRequestTypeOfUI, NULL, NULL,
&fSupported);
// Check hr
// ask the SR engine to display the UI, and use the default window title
hr = cpRecognizer->DisplayUI(MY_HWND, NULL, contextStatus.szRequestTypeOfUI,
NULL, NULL);
// Check hr
Requirements
Header | sapi.h, sapi.idl |
Library | sapilib.lib |
Windows Embedded CE | Windows CE .NET 4.1 and later |