# TextToSpeechStartup (Windows only)

The TextToSpeechStartup call initializes the text-to-speech system; defines the windows procedure; checks for valid licenses; and loads the main and user pronunciation dictionaries. This call returns a value of type MMRESULT. This value is zero if initialization was successful. A single process can run multiple instances of DECtalk Software.

Syntax | MMRESULT TextToSpeechStartup | (HWND hWnd, LPTTS_HANDLE_T *phTTS, UINT uiDeviceNumber, DWORD dwDeviceOptions)
Parameters | HWND hWnd | This handle is used to send messages back to the window procedure. The window handle is used by DECtalk Software to inform the application when the buffer is full (if DECtalk Software in-memory calls are being used) or when the TextToSpeechSpeak() call encounters an index mark. A value of NULL is passed in if no window handle is desired.
| LPTTS_HANDLE_T *phTTS | Specifies a text-to-speech handle.
| UINT uiDeviceNumber | Specifies a device number of the wave output device. A value of WAVE_MAPPER can be used to select the first available device.
| DWORD dwDeviceOptions | Specifies how the wave output device is managed. It can be a combination of the following constants defined in include file ttsapi.h:
Constants | Description
OWN_AUDIO_DEVICE | The wave output device is opened. No other process can allocate the wave output device until TextToSpeechShutdown is called.
| If OWN_AUDIO_DEVICE is NOT specified, the wave output device is opened after audio is queued by the TextToSpeechSpeak() call. The wave output device is released when the text-to-speech system has completed speaking.
REPORT_OPEN_ERROR | If an attempt is made to open the wave output device while another process owns it, then an error message is sent to the calling application.
DO_NOT_USE_AUDIO_DEVICE | When this flag is set, speech samples are ignored until one of the text-to-speech special modes is set. The text-to-speech special modes can be used to write the speech samples to wave file, memory buffers, or log files. No error is returned if a wave output device is not present.
Return Value | This call returns a value of type MMRESULT. The return value is zero if the call is successful. The return value is one of the following constants:
Constant | Description
MMSYSERR_NOERROR | Normal successful completion (zero).
MMSYSERR_NODRIVER | No wave output device present.
MMSYSERR_NOMEM | Memory allocation error.
MMSYSERR_ERROR | DECtalk Software dictionary not found.
MMSYSERR_baddevice_id | Device ID out of range.
MMSYSERR_ALLOCATED | License exists but no more units available.
WAVERR_BADFORMAT | Wave output device does not support request format.
Comments | If the window procedure is defined, then a post message is sent to the calling application when a buffer is filled while in speech-to-memory mode, an error occurs, or an index mark is encountered. The default parameters are: ? Language: American English. ? Speaking rate: 200 words per minute. ? Speaker: Paul If you build an application for the static version of DECtalk Software, you must include the winmm.lib file in the list of input files for the linker.
See Also | Callback Routines and Window Procedures Dictionary Functions (Windows only) TextToSpeechLoadUserDictionary TextToSpeechOpenInMemory TextToSpeechOpenLogFile TextToSpeechOpenWaveOutFile TextToSpeechShutdown TextToSpeechSpeak TextToSpeechStartupEx TextToSpeechUnloadUserDictionary