The callback function has two parameters passed to it, and is defined as:
typedef void (* CompFunc)(void *userData, uint32 word);
userData
field is normally NULL, unless you supply the COMP_TAG_USERDATA
tag when creating the engine. Whatever value is associated with the tag gets passed directly to the callback function. The purpose of the userData
field is to pass things like a file pointer to the callback function. You would pass the file pointer as the data value associated with the COMP_TAG_USERDATA
tag. The engines then pass the value to the callback function whenever it is called.
The word
parameter to the callback is the word of data being generated by the engine. You must do something useful with this word. For example, you could copy it into a memory buffer, or write it to a file.