ObjectAL  2.1
ObjectAL API Reference (iOS) for Kobold2D developers
ALBuffer Class Reference

A buffer for audio data that will be played via a SoundSource. More...

#include <ALBuffer.h>

Collaboration diagram for ALBuffer:

List of all members.

Public Member Functions

id initWithName:data:size:format:frequency: (NSString *name,[data] void *data,[size] ALsizei size,[format] ALenum format,[frequency] ALsizei frequency)
 Initialize the buffer.
ALBuffersliceWithName:offset:size: (NSString *sliceName,[offset] ALsizei offset,[size] ALsizei size)
 Returns a part of the buffer as a new buffer.

Static Public Member Functions

id bufferWithName:data:size:format:frequency: (NSString *name,[data] void *data,[size] ALsizei size,[format] ALenum format,[frequency] ALsizei frequency)
 Make a new buffer.

Protected Attributes

void * bufferData
 The uncompressed sound data to play.
ALBufferparentBuffer
 The parent buffer (which owns the uncompressed data)

Properties

ALint bits
 The size of a sample in bits.
ALuint bufferId
 The ID assigned to this buffer by OpenAL.
ALint channels
 The number of channels the buffer data plays in.
ALDevicedevice
 The device this buffer was created for.
ALenum format
 The format of the audio data (see al.h, AL_FORMAT_XXX).
ALint frequency
 The frequency this buffer runs at.
NSString * name
 The name given to this buffer upon creation.
ALint size
 The size, in bytes, of the currently loaded buffer data.
float duration
 The duration of the sample in this buffer, in seconds.
bool freeDataOnDestroy
 If true, calls free() on the audio data when this object gets destroyed.

Detailed Description

A buffer for audio data that will be played via a SoundSource.

See also:
SoundSource

Member Function Documentation

id ALBuffer::bufferWithName:data:size:format:frequency: ( NSString*  name,
[data] void*  data,
[size] ALsizei  size,
[format] ALenum  format,
[frequency] ALsizei  frequency 
) [static, virtual]

Make a new buffer.

Parameters:
nameOptional name that you can use to identify this buffer in your code.
dataThe sound data. Note: ALBuffer will call free() on this data when it is destroyed!
sizeThe size of the data in bytes.
formatThe format of the data (see the Core Audio documentation).
frequencyThe sampling frequency in Hz.
Returns:
A new buffer.
id ALBuffer::initWithName:data:size:format:frequency: ( NSString*  name,
[data] void*  data,
[size] ALsizei  size,
[format] ALenum  format,
[frequency] ALsizei  frequency 
) [virtual]

Initialize the buffer.

Parameters:
nameOptional name that you can use to identify this buffer in your code.
dataThe sound data. Note: ALBuffer will call free() on this data when it is destroyed!
sizeThe size of the data in bytes.
formatThe format of the data (see the Core Audio documentation).
frequencyThe sampling frequency in Hz.
Returns:
The initialized buffer.
ALBuffer * ALBuffer::sliceWithName:offset:size: ( NSString *  sliceName,
[offset] ALsizei  offset,
[size] ALsizei  size 
) [virtual]

Returns a part of the buffer as a new buffer.

You can use this method to split a buffer into a sub-buffers. The sub-buffers retain a reference to their parent buffer, and share the same memory. Therefore, modifying the parent buffer contents will affect its slices and vice-versa.

Parameters:
sliceNameOptional name that you can use to identify the created buffer in your code.
offsetThe offset in sound frames where the slice starts.
sizeThe size of the slice in frames.
Returns:
The requested buffer.

Member Data Documentation

void* ALBuffer::bufferData [protected]

The uncompressed sound data to play.

The parent buffer (which owns the uncompressed data)


Property Documentation

ALint ALBuffer::bits [read, assign]

The size of a sample in bits.

ALuint ALBuffer::bufferId [read, assign]

The ID assigned to this buffer by OpenAL.

ALint ALBuffer::channels [read, assign]

The number of channels the buffer data plays in.

ALDevice * ALBuffer::device [read, assign]

The device this buffer was created for.

float ALBuffer::duration [read, assign]

The duration of the sample in this buffer, in seconds.

ALenum ALBuffer::format [read, assign]

The format of the audio data (see al.h, AL_FORMAT_XXX).

bool ALBuffer::freeDataOnDestroy [read, write, assign]

If true, calls free() on the audio data when this object gets destroyed.

Default: YES

ALint ALBuffer::frequency [read, assign]

The frequency this buffer runs at.

NSString * ALBuffer::name [read, write, retain]

The name given to this buffer upon creation.

You may change it at runtime if you wish.

ALint ALBuffer::size [read, assign]

The size, in bytes, of the currently loaded buffer data.


The documentation for this class was generated from the following files: