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

A context encompasses a single listener and a series of sources. More...

#import <ALContext.h>

Inheritance diagram for ALContext:
<OALSuspendManager> <OALSuspendListener>

Instance Methods

(id) - initOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:
 Initialize this context on the specified device with attributes. More...
 
(id) - initOnDevice:attributes:
 Initialize this context for the specified device and attributes. More...
 
(void) - process
 Process this context. More...
 
(void) - stopAllSounds
 Stop all sound sources in this context. More...
 
(void) - clearBuffers
 Clear all buffers being used by sources in this context. More...
 
(void) - ensureContextIsCurrent
 Make sure this context is the current context. More...
 
(bool) - isExtensionPresent:
 Check if the specified extension is present in this context. More...
 
(void *) - getProcAddress:
 Get the address of the specified procedure (C function address). 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) + contextOnDevice:attributes:
 Create a new context on the specified device. More...
 
(id) + contextOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:
 Create a new context on the specified device with attributes. More...
 

Protected Attributes

NSMutableArray * sources
 All sound sources associated with this context. More...
 
bool suspended
 
NSMutableArray * attributes
 This context's attributes. More...
 
OALSuspendHandlersuspendHandler
 Handles suspending and interrupting for this object. More...
 

Properties

NSString * alVersion
 OpenAL version string in format “[spec major number]. More...
 
NSArray * attributes
 The current context's attribute list. More...
 
ALCcontext * context
 The OpenAL context pointer. More...
 
ALDevicedevice
 The device this context was opened on. More...
 
ALenum distanceModel
 The current distance model. More...
 
float dopplerFactor
 Exaggeration factor for Doppler effect. More...
 
NSArray * extensions
 List of available extensions (NSString*). More...
 
ALListenerlistener
 This context's listener. More...
 
NSString * renderer
 Information about the specific renderer. More...
 
NSArray * sources
 All sources associated with this context (ALSource*). More...
 
float speedOfSound
 Speed of sound in same units as velocities. More...
 
NSString * vendor
 Name of the vendor. 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 context encompasses a single listener and a series of sources.

A context is created from a device, and many contexts may be created (though multiple contexts would be unusual in an iOS app).

Note: Some property values are only valid if this context is the current context.

See Also
ObjectAL.currentContext

Method Documentation

- (void) clearBuffers

Clear all buffers being used by sources in this context.

+ (id) contextOnDevice: (ALDevice *)  device
attributes: (NSArray*)  attributes 

Create a new context on the specified device.

Parameters
deviceThe device to open the context on.
attributesAn array of NSNumber in ordered pairs (attribute id followed by integer value). Posible attributes: ALC_FREQUENCY, ALC_REFRESH, ALC_SYNC, ALC_MONO_SOURCES, ALC_STEREO_SOURCES
Returns
A new context.
+ (id) contextOnDevice: (ALDevice*)  device
outputFrequency: (int)  outputFrequency
refreshIntervals: (int)  refreshIntervals
synchronousContext: (bool)  synchronousContext
monoSources: (int)  monoSources
stereoSources: (int)  stereoSources 

Create a new context on the specified device with attributes.

Parameters
deviceThe device to open the context on.
outputFrequencyThe frequency to mix all sources to before outputting (ignored by iOS).
refreshIntervalsThe number of passes per second used to mix the audio sources. For games this can be 5-15. For audio intensive apps, it should be higher (ignored by iOS).
synchronousContextIf true, this context runs on the main thread and depends on you calling alcUpdateContext (ignored by iOS).
monoSourcesA hint indicating how many sources should support mono (default 28 on iOS).
stereoSourcesA hint indicating how many sources should support stereo (default 4 on iOS).
Returns
A new context.
- (void) ensureContextIsCurrent

Make sure this context is the current context.

This method is used to work around iOS 4.0 and 4.2 bugs that could cause the context to be lost.

- (void *) getProcAddress: (NSString*)  functionName

Get the address of the specified procedure (C function address).

Only valid when this is the current context.
Note: The OpenAL implementation is free to return a pointer even if it is not valid for this context. Always call isExtensionPresent first.

Parameters
functionNamethe name of the procedure to get.
Returns
the procedure's address, or NULL if it wasn't found.
- (id) initOnDevice: (ALDevice *)  device
attributes: (NSArray*)  attributes 

Initialize this context for the specified device and attributes.

Parameters
deviceThe device to open the context on.
attributesAn array of NSNumber in ordered pairs (attribute id followed by integer value). Posible attributes: ALC_FREQUENCY, ALC_REFRESH, ALC_SYNC, ALC_MONO_SOURCES, ALC_STEREO_SOURCES
Returns
The initialized context.
- (id) initOnDevice: (ALDevice*)  device
outputFrequency: (int)  outputFrequency
refreshIntervals: (int)  refreshIntervals
synchronousContext: (bool)  synchronousContext
monoSources: (int)  monoSources
stereoSources: (int)  stereoSources 

Initialize this context on the specified device with attributes.

Parameters
deviceThe device to open the context on.
outputFrequencyThe frequency to mix all sources to before outputting (ignored by iOS).
refreshIntervalsThe number of passes per second used to mix the audio sources. For games this can be 5-15. For audio intensive apps, it should be higher (ignored by iOS).
synchronousContextIf true, this context runs on the main thread and depends on you calling alcUpdateContext (ignored by iOS).
monoSourcesA hint indicating how many sources should support mono (default 28 on iOS).
stereoSourcesA hint indicating how many sources should support stereo (default 4 on iOS).
Returns
The initialized context.
- (bool) isExtensionPresent: (NSString*)  name

Check if the specified extension is present in this context.

Only valid when this is the current context.

Parameters
nameThe name of the extension to check.
Returns
TRUE if the extension is present in this context.
- (void) process

Process this context.

- (void) stopAllSounds

Stop all sound sources in this context.

Member Data Documentation

- (NSMutableArray*) attributes
protected

This context's attributes.

- (NSMutableArray*) sources
protected

All sound sources associated with this context.

- (OALSuspendHandler*) suspendHandler
protected

Handles suspending and interrupting for this object.

Property Documentation

- (NSString *) alVersion
readnonatomicretain

OpenAL version string in format “[spec major number].

[spec minor number] [optional vendor version information]” Only valid when this is the current context.

- (NSArray*) attributes
readnonatomicretain

The current context's attribute list.

Only valid when this is the current context.

- (ALCcontext *) context
readnonatomicassign

The OpenAL context pointer.

- (ALDevice*) device
readnonatomicretain

The device this context was opened on.

- (ALenum) distanceModel
readwritenonatomicassign

The current distance model.

Legal values are AL_NONE, AL_INVERSE_DISTANCE, AL_INVERSE_DISTANCE_CLAMPED, AL_LINEAR_DISTANCE, AL_LINEAR_DISTANCE_CLAMPED, AL_EXPONENT_DISTANCE, and AL_EXPONENT_DISTANCE_CLAMPED. See the OpenAL spec for detailed information.
Only valid when this is the current context.

- (float) dopplerFactor
readwritenonatomicassign

Exaggeration factor for Doppler effect.

Only valid when this is the current context.

- (NSArray *) extensions
readnonatomicretain

List of available extensions (NSString*).

Only valid when this is the current context.

- (ALListener *) listener
readnonatomicretain

This context's listener.

- (NSString *) renderer
readnonatomicretain

Information about the specific renderer.

Only valid when this is the current context.

- (NSArray*) sources
readnonatomicretain

All sources associated with this context (ALSource*).

- (float) speedOfSound
readwritenonatomicassign

Speed of sound in same units as velocities.

Only valid when this is the current context.

- (NSString *) vendor
readnonatomicretain

Name of the vendor.

Only valid when this is the current context.


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