ALBuffer Class Reference
Inherits from | NSObject |
Declared in | ALBuffer.h |
Tasks
-
bits
The size of a sample in bits.
property -
bufferId
The ID assigned to this buffer by OpenAL.
property -
channels
The number of channels the buffer data plays in.
property -
device
The device this buffer was created for.
property -
format
The format of the audio data (see al.h, AL_FORMAT_XXX).
property -
frequency
The frequency this buffer runs at.
property -
name
The name given to this buffer upon creation. You may change it at runtime if you wish.
property -
size
The size, in bytes, of the currently loaded buffer data.
property -
duration
The duration of the sample in this buffer, in seconds.
property -
freeDataOnDestroy
If true, calls free() on the audio data when this object gets destroyed. Default: YES
property -
+ bufferWithName:data:size:format:frequency:
Make a new buffer.
-
– initWithName:data:size:format:frequency:
Initialize the buffer.
-
– sliceWithName:offset: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.
Properties
bits
The size of a sample in bits.
@property (nonatomic, readonly) ALint bits
Declared In
ALBuffer.h
bufferId
The ID assigned to this buffer by OpenAL.
@property (nonatomic, readonly) ALuint bufferId
Declared In
ALBuffer.h
channels
The number of channels the buffer data plays in.
@property (nonatomic, readonly) ALint channels
Declared In
ALBuffer.h
device
The device this buffer was created for.
@property (nonatomic, readonly) ALDevice *device
Declared In
ALBuffer.h
duration
The duration of the sample in this buffer, in seconds.
@property (nonatomic, readonly) float duration
Declared In
ALBuffer.h
format
The format of the audio data (see al.h, AL_FORMAT_XXX).
@property (nonatomic, readonly) ALenum format
Declared In
ALBuffer.h
freeDataOnDestroy
If true, calls free() on the audio data when this object gets destroyed. Default: YES
@property (nonatomic, readwrite, assign) bool freeDataOnDestroy
Declared In
ALBuffer.h
frequency
The frequency this buffer runs at.
@property (nonatomic, readonly) ALint frequency
Declared In
ALBuffer.h
Class Methods
bufferWithName:data:size:format:frequency:
Make a new buffer.
+ (id)bufferWithName:(NSString *)name data:(void *)data size:(ALsizei)size format:(ALenum)format frequency:(ALsizei)frequency
Parameters
- name
Optional name that you can use to identify this buffer in your code.
- data
The sound data. Note: ALBuffer will call free() on this data when it is destroyed!
- size
The size of the data in bytes.
- format
The format of the data (see the Core Audio documentation).
- frequency
The sampling frequency in Hz.
Return Value
A new buffer.
Declared In
ALBuffer.h
Instance Methods
initWithName:data:size:format:frequency:
Initialize the buffer.
- (id)initWithName:(NSString *)name data:(void *)data size:(ALsizei)size format:(ALenum)format frequency:(ALsizei)frequency
Parameters
- name
Optional name that you can use to identify this buffer in your code.
- data
The sound data. Note: ALBuffer will call free() on this data when it is destroyed!
- size
The size of the data in bytes.
- format
The format of the data (see the Core Audio documentation).
- frequency
The sampling frequency in Hz.
Return Value
The initialized buffer.
Declared In
ALBuffer.h
sliceWithName:offset: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.
- (ALBuffer *)sliceWithName:(NSString *)sliceName offset:(ALsizei)offset size:(ALsizei)size
Parameters
- sliceName
Optional name that you can use to identify the created buffer in your code.
- offset
The offset in sound frames where the slice starts.
- size
The size of the slice in frames.
Return Value
The requested buffer.
Declared In
ALBuffer.h