Function

SpeakString

Begins speaking a text string.

Declaration

OSErr SpeakString(ConstStr255Param textToBeSpoken);

Parameters

textToBeSpoken

The string to be spoken.

Return Value

A result code. See Result Codes.

Discussion

The SpeakString function attempts to speak the Pascal-style text string contained in the string textToBeSpoken. Speech is produced asynchronously using the default system voice. When an application calls this function, the Speech Synthesis Manager makes a copy of the passed string and creates any structures required to speak it. As soon as speaking has begun, control is returned to the application. The synthesized speech is generated asynchronously to the application so that normal processing can continue while the text is being spoken. No further interaction with the Speech Synthesis Manager is required at this point, and the application is free to release the memory that the original string occupied.

If SpeakString is called while a prior string is still being spoken, the sound currently being synthesized is interrupted immediately. Conversion of the new text into speech is then begun. If you pass a zero-length string (or, in C, a null pointer) to SpeakString, the Speech Synthesis Manager stops any speech previously being synthesized by SpeakString without generating additional speech. If your application uses SpeakString, it is often a good idea to stop any speech in progress whenever your application receives a suspend event. Calling SpeakString with a zero-length string has no effect on speech channels other than the one managed internally by the Speech Synthesis Manager for the SpeakString function.)

The text passed to the SpeakString function may contain embedded speech commands.

See Also

Starting, Stopping, and Pausing Speech

ContinueSpeech

Resumes speech paused by the PauseSpeechAt function.

PauseSpeechAt

Pauses speech on a speech channel.

SpeakBuffer

Speaks a buffer of text, using certain flags to control speech behavior.

Deprecated
SpeakCFString

Begins speaking a string represented as a CFString object.

SpeakText

Begins speaking a buffer of text.

Deprecated
StopSpeech

Terminates speech immediately on the specified channel.

StopSpeechAt

Terminates speech delivery on a specified channel either immediately or at the end of the current word or sentence.