# Multi-Language Programming Example

This example shows DECtalk ML allocating English (us), creating a thread, destroying the thread, and finally closing the language.

void sample(void) {

unsigned long int UShandle;

MMRESULT result;

LPTTS_HANDLE_T phTTS;

UShandle = TextToSpeechStartLang("us");

if (UShandle & TTS_LANG_ERROR) {

printf("Error loading US English\n");

exit(1);

}

if (TextToSpeechSelectLang(NULL, UShandle) == FALSE) {

printf("Error selecting language\n");

TextToSpeechCloseLang("us");

exit(1);

}

result = TextToSpeechStartup(hWnd, &phTTS, WAVE_MAPPER,

REPORT_OPEN_ERROR);

if (result != MMSYSERR_NOERROR) {

printf("Unable to start DECtalk Speech Engine\n");

TextToSpeechCloseLang("us");

exit(1);

}

TextToSpeechShutdown(phTTS);

TextToSpeechCloseLang("us");

printf("Example completed successfully!\n");

return;

}

Related Topics