Supporting Multiple Engine Instances

It is important that engines 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 text-to-speech.

· Text-to-speech may be occurring over multiple destinations at the same time, such as the user's computer, one of several telephone lines, and multiple files.

The text-to-speech engine is an OLE COM object based on a DLL. This means that it uses the process and memory of the executable 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 dictionaries and phoneme models. In addition, because the instances are in the same process space, they can share memory, or the data can be shared between processes by using shared memory files. 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.