You are reading help file online using chmlib.com
|
ISpRecognizer::GetInputObjectToken retrieves the input token object for the stream currently being used.
GetInputObjectToken will always return the default audio input object token when using a shared recognizer.
HRESULT GetInputObjectToken(
ISpObjectToken **ppToken
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
S_FALSE | Function completed successfully, but the input stream object has no object token associated with it. |
E_POINTER | ppToken is invalid or bad. |
SPERR_UNINITIALIZED | No audio input has yet been set with SetInput (InProc engine only). |
FAILED(hr) | Appropriate error message. |
Applications will not normally need to use this method, but it can be used to find out specific details of the object token that was used to create the audio input stream.
If an application receives feedback from the SR engine that recognition quality is low, (e.g., poor audio signal quality (see SPEI_INTERFERENCE, or that the microphone needs adjustment (see SPEI_REQUEST_UI for SPDUI_MicTraining), etc.), it may be helpful to reconfigure the audio input settings. SAPI defines two specific types of audio UI that an audio object token can provide: volume (SPDUI_AudioVolume) and properties (SPDUI_AudioProperties). An application can use ::GetInputObjectToken, ISpObjectToken::IsUISupported, and ISpObjectToken::DisplayUI to display audio UI in an effort to improve speech recognition.
The following code snippet illustrates the use of ISpRecognizer::GetInputObjectToken when displaying audio UI.
HRESULT hr = S_OK; // check if the current recognizer has an object token hr = cpRecognizer->GetInputObjectToken(&cpObjectToken); // Check hr == S_OK
// get the object token's UI hr = cpObjectToken->QueryInterface(&cpTokenUI); // Check hr
// check if the default audio input object has UI for Volume hr = cpTokenUI->IsUISupported(SPDUI_AudioVolume, NULL, NULL, NULL, &fSupported); // Check hr // if fSupported == TRUE, then audio input object has UI for Volume // Display the default audio input object's Volume UI hr = cpTokenUI->DisplayUI(MY_HWND, MY_AUDIO_DIALOG_TITLE, SPDUI_AudioVolume, NULL, NULL, cpObjectToken, NULL); // Check hr
You are reading help file online using chmlib.com
|