# TextToSpeechStartupEx

The TextToSpeechStartupEx call initializes the text-to-speech system; defines the callback 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 TextToSpeechStartupEx | (LPTTS_HANDLE_T *phTTS, UINT uiDeviceNumber, DWORD dwDeviceOptions, VOID (*DtCallbackRoutine)(), LONG dwCallbackParameter)
### Parameters | 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 constants defined in include file ttsapi.h.
| VOID (*DtCallbackRoutine)() | Specifies a callback routine. The callback routine 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. Click here to go to the Callback Routines and Window Procedures help for information about the argument list for the callback routine. A value of NULL is passed in if no callback routine is desired.
| LONG dwCallbackParameter | Points to a user-specified parameter. It is used to pass parameters in the callback routine. A value of NULL should be passed in if no user-specified parameters are desired.
Constant in ttsapi.h | 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 a callback is sent to the callback routine that was passed to this call.
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.
MMSYSERR_NOTENABLED | License does not exist. (UNIX only)
WAVERR_BADFORMAT | Wave output device does not support request format.