IVoiceText::Speak

This method starts playing the specified text.

Syntax

HRESULT Speak( PTSTR pszSpeak, DWORD dwFlags, PTSTR pszTags);

Parameters

pszSpeak
[in] Pointer to a buffer that contains the text to speak. The text is in the form of a null-terminated string. The length of the text string must be less than 2 kilobytes (KB). Strings longer than 2 KB cause unexpected speech behavior. An application can free or modify the buffer as soon as Speak returns. The string pointed to by this parameter can contain text-to-speech control tags. In Auto PC, this string can contain the TTS tags. For more information about tags, see Text-to-Speech Tags.
dwFlags
[in] Specifies priority of the text. It is one of the following values:
VTXTSP_HIGH
Play the text as soon as possible, after text that is currently being spoken but before any other text in the playback queue.
VTXTSP_NORMAL
Add the text to the end of the playback queue. This is the default priority.
VTXTSP_VERYHIGH
Play the text immediately, interrupting text that is currently being spoken, if any. The interrupted text resumes playing as soon as the very high priority text is finished, although the interrupted text may not be correctly synchronized.
pszTags
[in] Ignored.

Return Values

NOERROR
The method successfully started playing the specified text.
VTXTERR_INVALIDMODE
The text-to-speech mode is invalid, or the application has not been registered to use the voice text on the site.
VTXTERR_INVALIDPARAM
A parameter is invalid.
VTXTERR_NOTENABLED
Voice text is not enabled.
VTXTERR_OUTOFMEM
There is not enough memory.
VTXTERR_QUEUEFULL
The playback queue is full.
VTXTERR_WAVEDEVICEBUSY
The wave device is busy.

Remarks

If an application calls the Speak method when other text is being played, the specified text is added to the end of the playback queue, unless the application specifies a higher priorityfor the new text in dwFlags.

Calling Speak affects all applications using voice text on the site, because all applications share the same playback queue.

The type of speech specified by dwFlags is communicated to the text-to-speech engine though control tags. Support of most control tags is optional; the engine ignores unsupported tags.

See Also

IVoiceText::StopSpeaking