Carbon


SpeechDoneProcPtr

Header: SpeechSynthesis.h Carbon status: Supported

Defines a pointer to a speech-done callback function. Your speech-done function is called when the Speech Manager finishes speaking a buffer of text.

typedef void(* SpeechDoneProcPtr) (
    SpeechChannel chan, 
    SInt32 refCon
);

You would declare your function like this if you were to name it MySpeechDoneCallback:

void MySpeechDoneCallback (
    SpeechChannel chan, 
    SInt32 refCon
);
Parameter descriptions
chan

The speech channel that has finished processing input text.

refCon

The reference constant associated with the speech channel.

DISCUSSION

If a speech-done callback function is installed in a speech channel, then the Speech Manager calls this function when it finishes speaking a buffer of text.

You can specify a speech-done callback procedure by passing the soSpeechDoneCallBack selector to the SetSpeechInfo function.

You might use a speech-done callback function if you need to update some visual indicator that shows what text is currently being spoken. For example, suppose your application passes text buffers to the Speech Manager one paragraph at a time. Your speech-done callback function might set a global flag variable to indicate to the application that the Speech Manager has finished speaking a paragraph. When a function called by your application’s main event loop checks the global flag variable and determines that it has been set, the function might ensure that the next paragraph of text is visible.

You might use a speech-done callback function to set a flag variable that alerts the application that it should pass a new buffer of text to the Speech Manager. If you do so, however, there might be a noticeable pause as the Speech Manager switches from processing one text buffer to another. Ordinarily, it is easier to achieve this goal by using a text-done callback function, as described earlier.

SPECIAL CONSIDERATIONS

Because your callback function executes at interrupt time, you must not call any functions that might move or purge memory.

Your callback function is able to access application global variables only if the A5 register is properly set. The Speech Manager sets A5 to the proper value if you provide your application’s A5 value by calling the SetSpeechInfo function with the soCurrentA5 selector.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)