Welcome, Guest! Log In | Create Account

Extending SmartBody BML

From smartbody

Jump to: navigation, search

TODO

Very roughly:

Add a new bml_*.cpp and bml_*.hpp files in core\smartbody\smartbody-lib\src\sbm corresponding to you new behavior tag. For example, if the behavior is <my:jump>, we could name the files bml_my_jump.*, or place them in core\smartbody\smartbody-lib\src\my and just name them bml_jump.*.

(There has been discussion of reorganizing all the files and directories, including creating a new bml directory. At that time, we would probably remove the bml_ prefix. Until then, please us our existing conventions.)

In these files, we need a parse function and a new BehaviorRequest class. The parse function is responsible for parsing the behavior specific XML attributes and constructing the BehaviorRequest instance. The BehaviorRequest represents the behavior during BML processing, and is later responsible for scheduling and unscheduling the behavior implementation. Preferably, these should be located in a BML namespace.

The parse function should follow the following function prototype:

BML::BehaviorRequest*
parse_bml_jump(
    DOMElement* elem,
    const std::string& unique_id,
    BML::SynchPoints& synchs,
    BML::BmlRequestPtr request,
    mcuCBHandle *mcu
)

Standardizing the parse function will assist us moving to a dynamic binding of BML behavior factories. If you believe your behavior needs other attributes, please open up a discussion about your needs on the developer mailing list.

The parse function parameters are:

elem The XML element representing the behavior.
unique_id A dynamically generated string representing the behavior, for references in debug output.
synchs An ordered collection of standard SynchPoints already parsed by the parent BmlRequest. New custom synch points may also be added to this collection for later reference and synchronization, such as the word-break SynchPoints of a speech behavior.
request A pointer (Boost shared pointer) to the parent BmlRequest.
mcu