Carbon


SpeechSyncProcPtr

Header: SpeechSynthesis.h Carbon status: Supported

Defines a pointer to a synchronization callback function. Your synchronization function is called when the Speech Manager encounters a synchronization command embedded in a text buffer.

typedef void(* SpeechSyncProcPtr) (
    SpeechChannel chan, 
    SInt32 refCon, 
    OSType syncMessage
);

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

void MySpeechSyncCallback (
    SpeechChannel chan, 
    SInt32 refCon, 
    OSType syncMessage
);
Parameter descriptions
chan

The speech channel that has finished processing input text.

refCon

The reference constant associated with the speech channel.

syncMessage

The synchronization message passed in the embedded command. Usually, you use this message to distinguish between several different types of synchronization commands, but you can use it any way you wish.

DISCUSSION

The Speech Manager calls a speech channel’s synchronization callback function whenever it encounters a synchronization command embedded in a text buffer. You might use the synchronization callback function to provide a callback not ordinarily provided. For example, you might inset synchronization commands at the end of every sentence in a text buffer, or you might enter synchronization commands after every numeric value in the text. However, to synchronize your application with phonemes or words, it makes more sense to use the built-in phoneme and word callback functions, defined in SpeechPhonemeProcPtr.

You can specify a synchronization callback procedure by passing the soSyncCallBack selector to the SetSpeechInfo function and embedding a synchronization command within a text buffer passed to the SpeakText or SpeakBuffer function.

SPECIAL CONSIDERATIONS

Because your callback function executes at interrupt time, you must not call any functions that might move or purge memory. If you need to make a visual change in response to a synchronization command, then use the callback function to set a global flag variable. Your application’s main event loop can check this flag and update the screen display if it is set.

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)