ALSource Class Reference
Inherits from | NSObject |
Conforms to | ALSoundSource OALSuspendManager |
Declared in | ALSource.h |
Overview
A source represents an object that emits sound which can be heard by a listener. This source can have position, velocity, and direction.
Tasks
-
buffer
property -
buffersQueued
property -
buffersProcessed
property -
context
property -
offsetInBytes
property -
offsetInSamples
property -
offsetInSeconds
property -
sourceId
property -
state
property -
+ source
-
+ sourceOnContext:
-
– initOnContext:
-
– play
-
– queueBuffer:
-
– queueBuffer:repeats:
-
– queueBuffers:
-
– queueBuffers:repeats:
-
– unqueueBuffer:
-
– unqueueBuffers:
-
– registerNotification:callback:userData:
-
– unregisterNotification:
-
– unregisterAllNotifications
Properties
buffer
The sound buffer this source is attached to (set to nil to detach the currently attached buffer).
@property (nonatomic, readwrite, retain) ALBuffer *buffer
Declared In
ALSource.h
buffersProcessed
How many of these buffers have been processed during playback.
@property (nonatomic, readonly, assign) int buffersProcessed
Declared In
ALSource.h
buffersQueued
How many buffers this source has queued.
@property (nonatomic, readonly, assign) int buffersQueued
Declared In
ALSource.h
context
The context this source was opened on.
@property (nonatomic, readonly, retain) ALContext *context
Declared In
ALSource.h
offsetInBytes
The offset into the current buffer (in bytes).
@property (nonatomic, readwrite, assign) float offsetInBytes
Declared In
ALSource.h
offsetInSamples
The offset into the current buffer (in samples).
@property (nonatomic, readwrite, assign) float offsetInSamples
Declared In
ALSource.h
offsetInSeconds
The offset into the current buffer (in seconds).
@property (nonatomic, readwrite, assign) float offsetInSeconds
Declared In
ALSource.h
sourceId
OpenAL’s ID for this source.
@property (nonatomic, readonly, assign) ALuint sourceId
Declared In
ALSource.h
state
The state of this source.
@property (nonatomic, readwrite, assign) int state
Declared In
ALSource.h
Instance Methods
initOnContext:
- (id)initOnContext:(ALContext *)context
Return Value
A new source.
Declared In
ALSource.h
play
Play the currently attached buffer.
- (id<ALSoundSource>)play
Return Value
the source playing the sound, or nil if the sound could not be played.
Declared In
ALSource.h
queueBuffer:
- (bool)queueBuffer:(ALBuffer *)buffer
Parameters
- buffer
the buffer to add to the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
queueBuffer:repeats:
- (bool)queueBuffer:(ALBuffer *)buffer repeats:(NSUInteger)repeats
Parameters
- buffer
the buffer to add to the queue.
- repeats
the number of times to repeat the buffer in the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
queueBuffers:
Add buffers to the buffer queue.
- (bool)queueBuffers:(NSArray *)buffers
Parameters
- buffers
the buffers to add to the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
queueBuffers:repeats:
Add buffers to the buffer queue, repeating it multiple times. The buffers will be played in order, repeating the specified number of times.
- (bool)queueBuffers:(NSArray *)buffers repeats:(NSUInteger)repeats
Parameters
- buffers
the buffers to add to the queue.
- repeats
the number of times to repeat the buffer in the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
registerNotification:callback:userData:
Register to receive notifications about an event on this source. (iOS 5.0+)
- (void)registerNotification:(ALuint)notificationID callback:(OALSourceNotificationCallback)callback userData:(void *)userData
Parameters
- notificationID
The kind of notification to be informed of (see above).
- callback
The block to call for notification.
- userData
a pointer that will be passed to the callback.
Discussion
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.
Declared In
ALSource.h
unqueueBuffer:
- (bool)unqueueBuffer:(ALBuffer *)buffer
Parameters
- buffer
the buffer to remove from the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
unqueueBuffers:
Remove buffers from the buffer queue
- (bool)unqueueBuffers:(NSArray *)buffers
Parameters
- buffers
the buffers to remove from the queue.
Return Value
TRUE if the operation was successful.
Declared In
ALSource.h
unregisterAllNotifications
Unregister all notifications for this source. (iOS 5.0+)
- (void)unregisterAllNotifications
Declared In
ALSource.h
unregisterNotification:
Unregister notifications for a notification type on this source. (iOS 5.0+)
- (void)unregisterNotification:(ALuint)notificationID
Parameters
- notificationID
The kind of notification to remove.
Declared In
ALSource.h