TextToSpeechSpeak

The TextToSpeechSpeak call queues a null-terminated string to the text-to-speech system. While in startup state, speech samples are routed to the audio device or ignored, depending on whether the DO_NOT_USE_AUDIO_DEVICE flag is set in the dwDeviceOptions parameter of the startup function. If the text_to_speech system is in one of its special modes (wave-file, log-file, or speech-to-memory modes), the speech samples are handled accordingly.

Syntax

MMRESULT TextToSpeechSpeak

(LPTTS_HANDLE_T phTTS,
LPSTR pszTextString,
DWORD
dwFlags)

Parameters

LPTTS_HANDLE_T phTTS

Specifies a text-to-speech handle.

 

LPSTR pszTextString

Points to a null terminated string of characters to be queued

 

DWORD dwFlags

Specifies whether the text is to be pushed through the text-to-speech system even if it does NOT end on a clause boundary. It can be set to one of the following constants defined in include file ttsapi.h:

Constant

Description

TTS_NORMAL

Insert characters in the text-to-speech queue.

TTS_FORCE

Insert characters in the text-to-speech queue and force all text to be output even if the text stream does NOT end on a clause boundary.

 

 

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 _NOMEM

Unable to allocate memory.

MMSYSERR_INVALHANDLE

The text-to-speech handle was invalid.

 

 

Comments

The speaker, speaking rate, and volume can also be changed in the text string by inserting in-line commands as shown in the following example:

[:name paul] I am Paul. [:nb] I am Betty. [:volume set 50] The volume has been set to 50% of the maximum level. [:ra 120] I am speaking at 120 words per minute.

See Also

btn_mini.gif Special Speech-To-Text Modes

btn_mini.gif TextToSpeechOpenInMemory

btn_mini.gif TextToSpeechOpenLogFile

btn_mini.gif TextToSpeechOpenWaveOutFile

btn_mini.gif TextToSpeechStartup (UNIX)

btn_mini.gif TextToSpeechStartup (Windows)

btn_mini.gif TextToSpeechStartupEx