C4 Engine Terathon Software C4 Engine API Documentation

• Sound Manager

API Links
Developer Links

SoundStreamer::FillBuffer

Defined in:  C4Sound.h
Called when audio data is needed.
Prototype

virtual bool FillBuffer(unsigned_int32 bufferSize, Sample *buffer, int32 *count) = 0;

Parameters
bufferSize The number of bytes of audio data that is needed.
buffer A pointer to the buffer that is to receive the audio data.
count A pointer to an integer that receives the total number of frames written to the buffer.
Description
The Sound Manager calls the FillBuffer function when audio data is needed from a stream. The streamer should fill the buffer specified by the buffer parameter with as many audio samples as possible without exceeding the byte count specified by the bufferSize parameter. Each audio sample is 16 bits in size, and the data should be stored in little endian byte order.

The value of bufferSize will never be larger than the value of the streamSize parameter passed to the SoundStreamer::AllocateStreamMemory function. The actual number of audio frames written to the buffer should be written to the integer pointed to by the count parameter.

The return value should be true if there is more audio data available in the stream after filling the buffer, and it should be false if the end of the stream has been reached.
See Also

SoundStreamer::StartStream

SoundStreamer::StartStreamComponent

SoundStreamer::AllocateStreamMemory