Supporting Multiple Engine Instances

It is important that an engine support multiple instances, both within the same process and within multiple processes, for the following reasons:

· If multiple instances are not supported, one application may preclude another from using speech recognition.

· Speech recognition may be occurring simultaneously from multiple sources, such as the user's computer, one of several telephone lines, and multiple files.

The speech-recognition engine is an OLE COM object based on a DLL. This means that it uses the process and memory of the executable module that calls it.

In general, each engine object should be independent of any other objects created by the DLL. However, some data should be shared to reduce memory consumption.

To minimize memory usage and start-up times, all instances should share common databases, such as lexicons and speaker-independent models. In addition, because the instances are in the same process space, they can share memory. However, make sure the instances cooperate when they share data, especially if they modify it. Note also that the instances may be running under separate threads, so mutual exclusion calls will be necessary.

You should employ the following protection schemes:

· Changing a run-time attribute for one instance should not affect other instances.

· Enabling, disabling, pausing, or resuming one instance should not affect other instances.

· One system user (as logged on) should not be able to affect the engine preferences for another system user.

After all of the engine objects are released, the DLL should free any shared memory used among the instances.

For information about sharing a speech-recognition engine among multiple applications, see the section, "Low-Level Speech Recognition API."