Return of Memory Buffers

When the memory buffer is completed, the memory buffer is returned to the calling application. A memory buffer is considered completed when any one of the following occur:

·      The memory buffer, which is pointed to by the lpData field, is filled.

·      The phoneme array is filled.

btn_mini.gif Click here to go to the help on Phonemic Symbols for more information on the phoneme codes.

·      The index mark array is filled.

btn_mini.gif Click here to go to the Index Mark for Speech Status help for more information on using index marks.

·      A TTS_FORCE argument is used in the call to TextToSpeechSpeak.

The application must not modify any buffer passed to the text-to-speech system by the TextToSpeechAddBuffer call until the buffer is returned from the text-to-speech system to the calling application. The application then owns the buffer. If no buffers are available, the system blocks. If the application is processing relatively long passages of text, it is recommended that the application queues several buffers and then requeues each buffer after finishing with it so that the system is not idle.

A call to TextToSpeechReset returns all buffers to the application. The TextToSpeechReturnBuffer call is supplied to force the return of the current memory buffer, whether it is filled or not. This call might not be required by most applications. It is includes so an application can obtain the last buffer without forcing that buffer to be sent with the TTS_FORCE command in the TextToSpeechSpeak call. This might be required if the application performs its own buffer management.

When the memory buffer, a TTS_BUFFER_T structure, is returned to the calling application, it contains the following return values:

Memory Buffer Return Values

Parameter

Value

dwBufferLength

Number of bytes of audio samples.

lpData

Pointer to the audio sample data.

dwNumberOfPhonemeChanges

Number of phoneme changes.

lpPhonemeArray

Pointer to the phoneme information.

dwNumberOfIndexMarks

Number of index marks.

lpIndexArray

Pointer to the index mark information.

 

The index and phoneme arrays each contain a time stamp in the form of a sample number. This sample number is initialized at zero at startup and after each call to TextToSpeechReset. The phoneme array also contains the current phoneme duration in frames. Each frame is approximately 6.4 milliseconds.

btn_mini.gif Related topics