Contents

SpeakString

Begins speaking a text string.

Declaration

OSErr SpeakString(ConstStr255Param textToBeSpoken);

Parameters

  • textToBeSpoken:

    The string to be spoken.

Return Value

A resultcode. See Result Codes.

Discussion

The SpeakString functionattempts 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 Managermakes a copy of the passed string and creates any structures requiredto speak it. As soon as speaking has begun, control is returnedto the application. The synthesized speech is generated asynchronously tothe application so that normal processing can continue while thetext is being spoken. No further interaction with the Speech SynthesisManager is required at this point, and the application is free torelease the memory that the original string occupied.

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

The text passed to the SpeakString functionmay contain embedded speech commands.

See Also

Starting, Stopping, and Pausing Speech