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

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

#import <ALSource.h>

Inheritance diagram for ALSource:
<ALSoundSource> <OALSuspendManager> <OALSuspendListener>

Instance Methods

(id) - initOnContext:
 Initialize a new source on the specified context. More...
 
(id< ALSoundSource >) - play
 Play the currently attached buffer. More...
 
(bool) - queueBuffer:
 Add a buffer to the buffer queue. More...
 
(bool) - queueBuffer:repeats:
 Add a buffer to the buffer queue, repeating it multiple times. More...
 
(bool) - queueBuffers:
 Add buffers to the buffer queue. More...
 
(bool) - queueBuffers:repeats:
 Add buffers to the buffer queue, repeating it multiple times. More...
 
(bool) - unqueueBuffer:
 Remove a buffer from the buffer queue. More...
 
(bool) - unqueueBuffers:
 Remove buffers from the buffer queue. More...
 
(void) - registerNotification:callback:userData:
 Register to receive notifications about an event on this source. More...
 
(void) - unregisterNotification:
 Unregister notifications for a notification type on this source. More...
 
(void) - unregisterAllNotifications
 Unregister all notifications for this source. More...
 
- Instance Methods inherited from <ALSoundSource>
(id< ALSoundSource >) - play:
 Play a sound. More...
 
(id< ALSoundSource >) - play:loop:
 Play a sound, optionally looping. More...
 
(id< ALSoundSource >) - play:gain:pitch:pan:loop:
 Play a sound, setting gain, pitch, pan, and looping. More...
 
(void) - stop
 Stop playing the current sound. More...
 
(void) - rewind
 Stop playing the current sound and set its state to AL_INITIAL. More...
 
(void) - fadeTo:duration:target:selector:
 Fade to the specified gain value. More...
 
(void) - stopFade
 Stop the currently running fade operation, if any. More...
 
(void) - panTo:duration:target:selector:
 pan to the specified value. More...
 
(void) - stopPan
 Stop the currently running pan operation, if any. More...
 
(void) - pitchTo:duration:target:selector:
 Gradually change pitch to the specified value. More...
 
(void) - stopPitch
 Stop the currently running pitch operation, if any. More...
 
(void) - stopActions
 Stop any currently running fade, pan, or pitch operations. More...
 
(void) - clear
 Clear any buffers this source is currently using. More...
 
- Instance Methods inherited from <OALSuspendManager>
(void) - addSuspendListener:
 Add a listener that will receive manual suspend and interrupt events. More...
 
(void) - removeSuspendListener:
 Remove a registered listener. More...
 

Class Methods

(id) + source
 Create a new source. More...
 
(id) + sourceOnContext:
 Create a new source on the specified context. More...
 

Protected Attributes

bool interruptible
 
float gain
 
bool muted
 
int shadowState
 Shadow value which keeps the correct state value for AL_PLAYING and AL_PAUSED. More...
 
bool abortPlaybackResume
 Used to abort a pending playback resume if the user calls stop or pause. More...
 
OALActiongainAction
 Current action operating on the gain control. More...
 
OALActionpanAction
 Current action operating on the pan control. More...
 
OALActionpitchAction
 Current action operating on the pitch control. More...
 
OALSuspendHandlersuspendHandler
 Handles suspending and interrupting for this object. More...
 

Properties

ALBufferbuffer
 The sound buffer this source is attached to (set to nil to detach the currently attached buffer). More...
 
int buffersQueued
 How many buffers this source has queued. More...
 
int buffersProcessed
 How many of these buffers have been processed during playback. More...
 
ALContextcontext
 The context this source was opened on. More...
 
float offsetInBytes
 The offset into the current buffer (in bytes). More...
 
float offsetInSamples
 The offset into the current buffer (in samples). More...
 
float offsetInSeconds
 The offset into the current buffer (in seconds). More...
 
ALuint sourceId
 OpenAL's ID for this source. More...
 
int state
 The state of this source. More...
 
- Properties inherited from <ALSoundSource>
float coneInnerAngle
 Cone inner angle (OpenAL property). More...
 
float coneOuterAngle
 Cone outer angle (OpenAL property). More...
 
float coneOuterGain
 Cone outer gain (OpenAL property). More...
 
ALVector direction
 Direction (OpenAL property). More...
 
float gain
 Gain (volume) (OpenAL property). More...
 
float volume
 Volume (alias to gain). More...
 
bool interruptible
 If true, this source may be interrupted when resources are low. More...
 
bool looping
 Looping (OpenAL property). More...
 
float maxDistance
 Max distance (OpenAL property). More...
 
float maxGain
 Max gain (OpenAL property). More...
 
float minGain
 Min gain (OpenAL property). More...
 
bool muted
 If true, this source is muted. More...
 
bool paused
 If true, this source is currently paused. More...
 
float pitch
 Pitch (OpenAL property). More...
 
bool playing
 If true, this source is currently playing audio. More...
 
ALPoint position
 Position (OpenAL property). More...
 
float referenceDistance
 Reference distance (OpenAL property). More...
 
float rolloffFactor
 Rolloff factor (OpenAL property). More...
 
int sourceRelative
 Source relative (OpenAL property). More...
 
int sourceType
 Source type (OpenAL property). More...
 
ALVector velocity
 Velocity (OpenAL property). More...
 
float pan
 Pan value (-1.0 = far left, 1.0 = far right). More...
 
float reverbSendLevel
 Reverb send level (how much reverb affects this source). More...
 
float reverbOcclusion
 Reverb occlusion (wall/door between listener and source). More...
 
float reverbObstruction
 Reverb obstruction (object between listener and source). More...
 
- Properties inherited from <OALSuspendManager>
bool suspended
 If YES, this object is suspended. More...
 
- Properties inherited from <OALSuspendListener>
bool manuallySuspended
 Set to YES to manually suspend. More...
 
bool interrupted
 If YES, this object is interrupted. More...
 

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.

Method Documentation

- (id) initOnContext: (ALContext*)  context

Initialize a new source on the specified context.

Parameters
contextthe context to create the source on.
Returns
A new source.
- (id< ALSoundSource >) play

Play the currently attached buffer.

Returns
the source playing the sound, or nil if the sound could not be played.
- (bool) queueBuffer: (ALBuffer*)  buffer

Add a buffer to the buffer queue.

Parameters
bufferthe buffer to add to the queue.
Returns
TRUE if the operation was successful.
- (bool) queueBuffer: (ALBuffer*)  buffer
repeats: (NSUInteger)  repeats 

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) queueBuffers: (NSArray*)  buffers

Add buffers to the buffer queue.

Parameters
buffersthe buffers to add to the queue.
Returns
TRUE if the operation was successful.
- (bool) queueBuffers: (NSArray*)  buffers
repeats: (NSUInteger)  repeats 

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.
- (void) registerNotification: (ALuint)  notificationID
callback: (OALSourceNotificationCallback)  callback
userData: (void*)  userData 

Register to receive notifications about an event on this source.

(iOS 5.0+)

The following notification types are recognized: AL_SOURCE_STATE - Sent when a source's state changes. AL_BUFFERS_PROCESSED - Sent when all buffers have been processed. AL_QUEUE_HAS_LOOPED - Sent when a looping source has looped to it's start point.

Parameters
notificationIDThe kind of notification to be informed of (see above).
callbackThe block to call for notification.
userDataa pointer that will be passed to the callback.
+ (id) source

Create a new source.

Returns
A new source.
+ (id) sourceOnContext: (ALContext*)  context

Create a new source on the specified context.

Parameters
contextthe context to create the source on.
Returns
A new source.
- (bool) unqueueBuffer: (ALBuffer*)  buffer

Remove a buffer from the buffer queue.

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

Remove buffers from the buffer queue.

Parameters
buffersthe buffers to remove from the queue.
Returns
TRUE if the operation was successful.
- (void) unregisterAllNotifications

Unregister all notifications for this source.

(iOS 5.0+)

- (void) unregisterNotification: (ALuint)  notificationID

Unregister notifications for a notification type on this source.

(iOS 5.0+)

Parameters
notificationIDThe kind of notification to remove.

Member Data Documentation

- (bool) abortPlaybackResume
protected

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

- (OALAction*) gainAction
protected

Current action operating on the gain control.

- (OALAction*) panAction
protected

Current action operating on the pan control.

- (OALAction*) pitchAction
protected

Current action operating on the pitch control.

- (int) 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.

- (OALSuspendHandler*) suspendHandler
protected

Handles suspending and interrupting for this object.

Property Documentation

- (ALBuffer *) buffer
readwritenonatomicretain

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

- (int) buffersProcessed
readnonatomicassign

How many of these buffers have been processed during playback.

- (int) buffersQueued
readnonatomicassign

How many buffers this source has queued.

- (ALContext *) context
readnonatomicretain

The context this source was opened on.

- (float) offsetInBytes
readwritenonatomicassign

The offset into the current buffer (in bytes).

- (float) offsetInSamples
readwritenonatomicassign

The offset into the current buffer (in samples).

- (float) offsetInSeconds
readwritenonatomicassign

The offset into the current buffer (in seconds).

- (ALuint) sourceId
readnonatomicassign

OpenAL's ID for this source.

- (int) state
readwritenonatomicassign

The state of this source.


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