Type Alias

SpeechTextDoneProcPtr

Defines a pointer to a text-done callback function that is called when the Speech Synthesis Manager has finished processing a buffer of text.

Declaration

typedef void (*SpeechTextDoneProcPtr)(SpeechChannel chan, SRefCon refCon, const void * _Nullable *nextBuf, unsigned long *byteLen, SInt32 *controlFlags);

Parameters

chan

The speech channel that has finished processing input text.

refCon

The reference constant associated with the speech channel.

nextBuf

On return, a pointer to the next buffer of text to process or NULL if your application has no additional text to be spoken. This parameter is mostly for internal use by the Speech Synthesis Manager.

byteLen

On return, a pointer to the number of bytes of the text buffer pointed to by the nextBuf parameter.

controlFlags

On return, a pointer to the control flags to be used in generating the next buffer of text.

Discussion

If a text-done callback function is installed in a speech channel, then the Speech Synthesis Manager calls this function when it finishes processing a buffer of text. The Speech Synthesis Manager might not yet have completed finishing speaking the text and indeed might not have started speaking it.

You can specify a text-done callback function by passing the soTextDoneCallBack selector to the SetSpeechInfo function.

A common use of a text-done callback function is to alert your application once the text passed to the SpeakText or SpeakBuffer function can be disposed of (or, when the text is contained within a locked relocatable block, when the relocatable block can be unlocked). The Speech Synthesis Manager copies the text you pass to the SpeakText or SpeakBuffer function into an internal buffer. Once it has finished processing the text, you may dispose of the original text buffer, even if speech is not yet complete. However, if you wish to write a callback function that executes when speech is completed, see the definition of a speech-done callback function below.

Although most applications will not need to, your callback function can indicate to the Speech Synthesis Manager whether there is another buffer of text to speak. If there is another buffer, your callback function should reference it by setting the nextBuf and byteLen parameters to appropriate values. (Your callback function might also change the control flags to be used to process the speech by altering the value in the controlFlags parameter.) Setting these parameters allows the Speech Synthesis Manager to generate uninterrupted speech. If there is no more text to speak, your callback function should set nextBuf to NULL. In this case, the Speech Synthesis Manager ignores the byteLen and controlFlags parameters.

If your text-done callback function does not change the values of the nextBuf and byteLen parameters, the text buffer just spoken will be spoken again.

See Also

Callbacks

SpeechDoneProcPtr

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

SpeechErrorProcPtr

Defines a pointer to an error callback function that handles syntax errors within commands embedded in a text buffer being processed by the Speech Synthesis Manager.

SpeechErrorCFProcPtr

Defines a pointer to an error callback function that handles syntax errors within commands embedded in a CFString object being processed by the Speech Synthesis Manager.

SpeechPhonemeProcPtr

Defines a pointer to a phoneme callback function that is called by the Speech Synthesis Manager before it pronounces a phoneme.

SpeechSyncProcPtr

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

SpeechWordProcPtr

Defines a pointer to a word callback function that is called by the Speech Synthesis Manager before it pronounces a word.

SpeechWordCFProcPtr

Defines a pointer to a Core Foundation-based word callback function that is called by the Speech Synthesis Manager before it pronounces a word.