Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Speech Recognition Manager /
Chapter 1 - Speech Recognition Manager / Using the Speech Recognition Manager


Saving and Loading Language Objects

The Speech Recognition Manager provides several functions that you can use to put a language object into the data or resource fork of a file and to load a saved language object from a file. For example, you can save a language model in a resource by calling the SRPutLanguageObjectIntoHandle function. This function creates a description of the language model and puts it into a block of memory you've already allocated, resizing the handle as necessary and overwriting any existing contents. You call SRPutLanguageObjectIntoHandle like this:

myErr = SRPutLanguageObjectIntoHandle(myLModel, myHandle);
If SRPutLanguageObjectIntoHandle returns successfully, you can then use standard Resource Manager routines (for example, AddResource) to add the data in the handle to a file's resource fork. The resource type and ID of the new resource are specified by your application.

You can read a saved language object from a resource by loading the resource using Resource Manager functions (for example, GetResource) and then converting the resource data into a language object by calling the SRNewLanguageObjectFromHandle function, like this:

myErr = SRNewLanguageObjectFromHandle(mySys, myLModel, myHandle);
The format of the language object data stored in a handle (or data file) is private. You should always use the supplied Speech Recognition Manager functions to read and write language object data.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 JAN 1997