Writing TTS Files Asynchronously
Last reviewed: 2/16/2004
HOW Article ID: H020401
The information in this article applies to:
- SpeechKit 4
The StartPlayback method provides 2 playback styles that determine whether control is returned once the request has been queued or after it is completed: CPSSynchronous and CPSAsynchronous.
When CPSAsynchronous is used, the synthesis must occur on a separate thread so control may be returned to the application once the request is queued. For non-COM component libraries (e.g., CDLL), this requires that the COM Initialization (CoInit) flag be set to 0 (Multithreaded) rather than it's default value of 2 (Apartment or Single). For example:
// C/C++ // Instantiate ChantSR object m_pChantSR = new CChantSR(TRUE,0);
For VCL components, change the CoInit property value to 0 in the property palette.
The Microsoft SAPI APIs are COM APIs. To be able to invoke these APIs on multiple threads, the component library must initialize the COM environment to a multithreaded environment.