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

A source represents an object that emits sound which can be heard by a listener. More...

#include <ALSource.h>

Inheritance diagram for ALSource:
Collaboration diagram for ALSource:

List of all members.

Public Member Functions

id initOnContext: (ALContext *context)
 Initialize a new source on the specified context.
id< ALSoundSourceplay ()
 Play the currently attached buffer.
bool queueBuffer: (ALBuffer *buffer)
 Add a buffer to the buffer queue.
bool queueBuffer:repeats: (ALBuffer *buffer,[repeats] NSUInteger repeats)
 Add a buffer to the buffer queue, repeating it multiple times.
bool queueBuffers: (NSArray *buffers)
 Add buffers to the buffer queue.
bool queueBuffers:repeats: (NSArray *buffers,[repeats] NSUInteger repeats)
 Add buffers to the buffer queue, repeating it multiple times.
bool unqueueBuffer: (ALBuffer *buffer)
 Remove a buffer from the buffer queue.
bool unqueueBuffers: (NSArray *buffers)
 Remove buffers from the buffer queue.

Static Public Member Functions

id source ()
 Create a new source.
id sourceOnContext: (ALContext *context)
 Create a new source on the specified context.

Protected Attributes

bool interruptible
 If true, this source may be interrupted when resources are low.
float gain
 Gain (volume) (OpenAL property).
bool muted
 If true, this source is muted.
int shadowState
 Shadow value which keeps the correct state value for AL_PLAYING and AL_PAUSED.
bool abortPlaybackResume
 Used to abort a pending playback resume if the user calls stop or pause.
OALActiongainAction
 Current action operating on the gain control.
OALActionpanAction
 Current action operating on the pan control.
OALActionpitchAction
 Current action operating on the pitch control.
OALSuspendHandlersuspendHandler
 Handles suspending and interrupting for this object.

Properties

ALBufferbuffer
 The sound buffer this source is attached to (set to nil to detach the currently attached buffer).
int buffersQueued
 How many buffers this source has queued.
int buffersProcessed
 How many of these buffers have been processed during playback.
ALContextcontext
 The context this source was opened on.
float offsetInBytes
 The offset into the current buffer (in bytes).
float offsetInSamples
 The offset into the current buffer (in samples).
float offsetInSeconds
 The offset into the current buffer (in seconds).
ALuint sourceId
 OpenAL's ID for this source.
int state
 The state of this source.

Detailed Description

A source represents an object that emits sound which can be heard by a listener.

This source can have position, velocity, and direction.


Member Function Documentation

id ALSource::initOnContext: ( ALContext context) [virtual]

Initialize a new source on the specified context.

Parameters:
contextthe context to create the source on.
Returns:
A new source.
id< ALSoundSource > ALSource::play ( ) [virtual]

Play the currently attached buffer.

Returns:
the source playing the sound, or nil if the sound could not be played.
bool ALSource::queueBuffer: ( ALBuffer buffer) [virtual]

Add a buffer to the buffer queue.

Parameters:
bufferthe buffer to add to the queue.
Returns:
TRUE if the operation was successful.
bool ALSource::queueBuffer:repeats: ( ALBuffer buffer,
[repeats] NSUInteger  repeats 
) [virtual]

Add a buffer to the buffer queue, repeating it multiple times.

Parameters:
bufferthe buffer to add to the queue.
repeatsthe number of times to repeat the buffer in the queue.
Returns:
TRUE if the operation was successful.
bool ALSource::queueBuffers: ( NSArray*  buffers) [virtual]

Add buffers to the buffer queue.

Parameters:
buffersthe buffers to add to the queue.
Returns:
TRUE if the operation was successful.
bool ALSource::queueBuffers:repeats: ( NSArray*  buffers,
[repeats] NSUInteger  repeats 
) [virtual]

Add buffers to the buffer queue, repeating it multiple times.

The buffers will be played in order, repeating the specified number of times.

Parameters:
buffersthe buffers to add to the queue.
repeatsthe number of times to repeat the buffer in the queue.
Returns:
TRUE if the operation was successful.
id ALSource::source ( ) [static, virtual]

Create a new source.

Returns:
A new source.
id ALSource::sourceOnContext: ( ALContext context) [static, virtual]

Create a new source on the specified context.

Parameters:
contextthe context to create the source on.
Returns:
A new source.
bool ALSource::unqueueBuffer: ( ALBuffer buffer) [virtual]

Remove a buffer from the buffer queue.

Parameters:
bufferthe buffer to remove from the queue.
Returns:
TRUE if the operation was successful.
bool ALSource::unqueueBuffers: ( NSArray*  buffers) [virtual]

Remove buffers from the buffer queue.

Parameters:
buffersthe buffers to remove from the queue.
Returns:
TRUE if the operation was successful.

Member Data Documentation

Used to abort a pending playback resume if the user calls stop or pause.

float ALSource::gain [protected]

Gain (volume) (OpenAL property).

Reimplemented from <ALSoundSource>.

Current action operating on the gain control.

bool ALSource::interruptible [protected]

If true, this source may be interrupted when resources are low.

Reimplemented from <ALSoundSource>.

bool ALSource::muted [protected]

If true, this source is muted.

Reimplemented from <ALSoundSource>.

Current action operating on the pan control.

Current action operating on the pitch control.

int ALSource::shadowState [protected]

Shadow value which keeps the correct state value for AL_PLAYING and AL_PAUSED.

We need this due to a buggy OpenAL implementation.

Handles suspending and interrupting for this object.


Property Documentation

ALBuffer * ALSource::buffer [read, write, retain]

The sound buffer this source is attached to (set to nil to detach the currently attached buffer).

int ALSource::buffersProcessed [read, assign]

How many of these buffers have been processed during playback.

int ALSource::buffersQueued [read, assign]

How many buffers this source has queued.

ALContext * ALSource::context [read, assign]

The context this source was opened on.

float ALSource::offsetInBytes [read, write, assign]

The offset into the current buffer (in bytes).

float ALSource::offsetInSamples [read, write, assign]

The offset into the current buffer (in samples).

float ALSource::offsetInSeconds [read, write, assign]

The offset into the current buffer (in seconds).

ALuint ALSource::sourceId [read, assign]

OpenAL's ID for this source.

int ALSource::state [read, write, assign]

The state of this source.


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