Contents

SpeechTextDoneProcPtr

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

Declaration

typealias SpeechTextDoneProcPtr = (SpeechChannel, SRefCon, UnsafeMutablePointer<UnsafeRawPointer?>?, UnsafeMutablePointer<UInt>, UnsafeMutablePointer<Int32>) -> Void

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 speechchannel, then the Speech Synthesis Manager calls this function whenit finishes processing a buffer of text. The Speech Synthesis Managermight not yet have completed finishing speaking the text and indeed mightnot have started speaking it.

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

A common use of a text-done callback function is to alertyour application once the text passed to the SpeakText or SpeakBuffer functioncan be disposed of (or, when the text is contained within a lockedrelocatable block, when the relocatable block can be unlocked). TheSpeech Synthesis Manager copies the text you pass to the SpeakText or SpeakBuffer functioninto an internal buffer. Once it has finished processing the text,you may dispose of the original text buffer, even if speech is notyet complete. However, if you wish to write a callback functionthat executes when speech is completed, see the definition of a speech-donecallback function below.

Although most applications will not need to, your callbackfunction can indicate to the Speech Synthesis Manager whether thereis another buffer of text to speak. If there is another buffer,your callback function should reference it by setting the nextBuf and byteLen parametersto appropriate values. (Your callback function might also changethe control flags to be used to process the speech by altering thevalue in the controlFlags parameter.)Setting these parameters allows the Speech Synthesis Manager togenerate 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 valuesof the nextBuf and byteLen parameters,the text buffer just spoken will be spoken again.

See Also

Callbacks