Buffers

A Buffer encapsulates OpenAL state related to storing sample data. The application can request and release Buffer objects, and fill them with data. Data can be supplied compressed and encoded as long as the format is supported. Buffers can, internally, contain waveform data as uncompressed or compressed samples,

Buffers can be non-streaming (default) or streaming. Non-streaming buffers are used to store looping and non-looping (single-shot) sound data. Streaming buffers have to be used to cache streaming media that the application can not keep in memory for technical reasons: e.g. data delivered in real time over network. Streaming buffers can also be used to partially store sound samples that the application coder consider too large to keep in memory at once.

Unlike Sources and Listener, Buffer Objects are shared among AL contexts. Buffers are referenced by Sources. A single Buffer can be referred to by multiple Sources. This separation allows driver and hardware to optimize storage and processing whereever applicable.

The simplest supported format for buffer data is PCM.

NoteAnnotation/ Compressed Buffers
 

Compressed formats are in no way guaranteed by the implementation to remain compressed. The driver might have to uncompres in memory at once, if no hardware-assisted or incremental decoding is possible. In many cases an implementation have to decompress the buffer, converting the uncompressed data to a canonical internal format, and resample it into the format native to the current context.

Buffer States

A Buffer is in one of 3 States: UNUSED, QUEUED, CURRENT. A single queue occurrence propgatates UNUSED to QUEUED. Source that are STOPPED or INITIAL still have queues that cause Buffers to be QUEUED. Source that are Reset() have a Queue that contains only bname 0.

Being referenced as current buffer by a single PLAYING or PAUSED Source propagates to CURRENT. A buffer is used if it is QUEUED or CURRENT.

Buffers that are CURRENT can not have their data changed by BufferData commands. Buffers that are QUEUED can not have their data changed either. Buffers that are unused can be changed by BufferData commands.

NoteAnnotation (State Query and Shared Buffers)
 

A buffer that is unused by one Source might be used by another. The Unqueue operation is determined by the number of queue entries already processed by the given Source. However, the application has to check whether the Buffer is still in use by other Sources. For now, applications have to maintain their own lists of buffer consumer (source) lists. If necessary, an explicit call to determine current buffer state with respect to all Sources might be added in future revisions.