Buffers

Buffers in OpenAl is what contain the sound data. A single buffer can be used by multiple sources.

Create & Destroy

Buffers are created with alGenBuffers and destroyed with alDeleteBuffers.

Attributes

Query these with alGetBuffer.

AL_FREQUENCY: The frequency in samples per seconds of the buffer.

AL_SIZE: Size in bytes of the buffer data.

AL_BITS: Number of bits per sample for the data in the buffer. 8 or 16.

AL_CHANNELS: The number of channels for data in the buffer. 1 or 2.

Buffer Data

Sound data is loaded to the buffer with alBufferData. It takes the format, the size and the frequency of the data. It will be copied so the pointer can be freed. Valid formats are AL_FORMAT_MONO8, AL_FORMAT_MONO16, AL_FORMAT_STEREO8 and AL_FORMAT_STEREO16. Stereo data is an interleaved format, left channel sample followed by right channel sample. Stereo sounds will be played without 3D position effect.