Microsoft Speech SDK
SAPI 5.1
ISpSREngineSite::GetRuleInfo
ISpSREngineSite::GetRuleInfo retrieves information about a CFG rule.
HRESULT GetRuleInfo(
SPRULEENTRY *pRuleEntry,
SPRULEINFOOPT Options
);
Parameters
- pRuleEntry
- [in, out] Address of the SPRULEENTRY structure that contains the grammar rule entry information.
- Options
- [in] One of the grammar rule options specified in the SPRULEINFOOPT enumeration sequence. (This should always be set to SPRIO_NONE).
Return values
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_POINTER | pRuleEntry points to invalid memory. |
E_INVALIDARG | Either invalid hRule rule handle or Options contains invalid flags. |
FAILED (hr) | Appropriate error message. |
Remarks
This method can be called after the engine has been informed of a rule with the ISpSREngine::RuleNotify method. This method can be used to recover rule information from the rule handle. Only the hRule rule handle field in the SPRULEENTRY needs to be filled in by the engine when calling this method. The engine will fill in:
- The pvClientRuleContext, which is a pointer that the engine can set using ISpSREngineSite::SetRuleClientContext.
- The pvClientGrammarContext, which is the pointer that the engine set in the ISpSREngine::OnCreateGrammar method. This indicates which grammar the rule belongs to.
- The Attributes field, of type SPCFGRULEATTRIBUTES, which contains some flags giving extra information about the rule:
SPAudioBufferInfo.ulMsMinNotification cannot be larger than one quarter the size of SPAudioBufferInfo.ulMsBufferSize and must not be zero. |
SPRAF_TopLevel if the rule is top-level and thus can be activated for recognition. |
SPRAF_Interpreter if the rule is associated with an Interpreter object for semantic processing. |
SPRAF_AutoPause if the rule is auto-pause. |
- The hInitialState field, which gives the initial state of the rule. Information on this and subsequent states can be obtained by calling the ISpSREngineSite::GetStateInfo method.