TTS_DEST_CB

Invoked when the Vocalizer instance needs to deliver output data to the application.

typedef LH_VOID* (*TTS_DEST_CB)(
 LH_VOID* pAppData,
 LH_U16 nOutputType,
 LH_VOID* pAudio,
 LH_U32 cAudioBytes,
 LH_U32* pcAudioBufferAlloc);

Argument

Description

pAppData

Application data pointer. Use the same value that was passed into TtsOpen.

nOutputType

Data type to be delivered. Must be TTS_OUTPUTTYPE_PCM.

pAudio

Pointer to the next output buffer where Vocalizer should deliver the data.

In the simplest case, the application allocates a single buffer and returns the same address every time.

More commonly, the application allocates a queue of buffers and returns the next address every time. Doing this retains each buffer for future access, and prevents an accidental overwrite of a buffer that is still needed, .

cAudioBytes

Size of the output buffer.

For optimal performance, set the size that is sufficient for 0.5 seconds of audio at the current sampling rate. (Round up to the nearest multiple of 1024 bytes.) See Optimal audio buffer size.

pcAudioBufferAlloc

[out] Size in bytes of the “new” data buffer passed back via the return value.

To register your callback, see TTS_OPEN_PARAMS.

The first call to TTS_DEST_CB passes in NULL for the output buffer and 0 for the data size, indicating that the TTS engine instance has not yet been given a buffer to fill. This also occurs each time the engine has finished processing a given message unit.

Return value(s): Pointer to the next output buffer.