ObjectAL
 All Classes Functions Variables Properties Pages
Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
ALBuffer Class Reference

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

#import <ALBuffer.h>

Inheritance diagram for ALBuffer:

Instance Methods

(id) - initWithName:data:size:format:frequency:
 Initialize the buffer. More...
 
(ALBuffer *) - sliceWithName:offset:size:
 Returns a part of the buffer as a new buffer. More...
 

Class Methods

(id) + bufferWithName:data:size:format:frequency:
 Make a new buffer. More...
 

Protected Attributes

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

Properties

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

Detailed Description

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

See Also
SoundSource

Method Documentation

+ (id) bufferWithName: (NSString*)  name
data: (void*)  data
size: (ALsizei)  size
format: (ALenum)  format
frequency: (ALsizei)  frequency 

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) initWithName: (NSString*)  name
data: (void*)  data
size: (ALsizei)  size
format: (ALenum)  format
frequency: (ALsizei)  frequency 

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 *) sliceWithName: (NSString *)  sliceName
offset: (ALsizei)  offset
size: (ALsizei)  size 

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*) bufferData
protected

The uncompressed sound data to play.

- (ALBuffer*) parentBuffer
protected

The parent buffer (which owns the uncompressed data)

Property Documentation

- (ALint) bits
readnonatomicassign

The size of a sample in bits.

- (ALuint) bufferId
readnonatomicassign

The ID assigned to this buffer by OpenAL.

- (ALint) channels
readnonatomicassign

The number of channels the buffer data plays in.

- (ALDevice *) device
readnonatomicretain

The device this buffer was created for.

- (float) duration
readnonatomicassign

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

- (ALenum) format
readnonatomicassign

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

- (bool) freeDataOnDestroy
readwritenonatomicassign

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

Default: YES

- (ALint) frequency
readnonatomicassign

The frequency this buffer runs at.

- (NSString *) name
readwritenonatomicretain

The name given to this buffer upon creation.

You may change it at runtime if you wish.

- (ALint) size
readnonatomicassign

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


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