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

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

#include <ALContext.h>

Inheritance diagram for ALContext:
Collaboration diagram for ALContext:

List of all members.

Public Member Functions

id initOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources: (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.
id initOnDevice:attributes: (ALDevice *device,[attributes] NSArray *attributes)
 Initialize this context for the specified device and attributes.
void process ()
 Process this context.
void stopAllSounds ()
 Stop all sound sources in this context.
void clearBuffers ()
 Clear all buffers being used by sources in this context.
void ensureContextIsCurrent ()
 Make sure this context is the current context.
bool isExtensionPresent: (NSString *name)
 Check if the specified extension is present in this context.
void * getProcAddress: (NSString *functionName)
 Get the address of the specified procedure (C function address).
void notifySourceInitializing: (ALSource *source)
 (INTERNAL USE) Used by ALSource to announce initialization.
void notifySourceDeallocating: (ALSource *source)
 (INTERNAL USE) Used by ALSource to announce deallocation.

Static Public Member Functions

id contextOnDevice:attributes: (ALDevice *device,[attributes] NSArray *attributes)
 Create a new context on the specified device.
id contextOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources: (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.

Protected Attributes

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

Properties

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

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

Member Function Documentation

void ALContext::clearBuffers ( ) [virtual]

Clear all buffers being used by sources in this context.

id ALContext::contextOnDevice:attributes: ( ALDevice device,
[attributes] NSArray*  attributes 
) [static, virtual]

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 ALContext::contextOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources: ( ALDevice device,
[outputFrequency] int  outputFrequency,
[refreshIntervals] int  refreshIntervals,
[synchronousContext] bool  synchronousContext,
[monoSources] int  monoSources,
[stereoSources] int  stereoSources 
) [static, virtual]

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 ALContext::ensureContextIsCurrent ( ) [virtual]

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 * ALContext::getProcAddress: ( NSString*  functionName) [virtual]

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 ALContext::initOnDevice:attributes: ( ALDevice device,
[attributes] NSArray*  attributes 
) [virtual]

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 ALContext::initOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources: ( ALDevice device,
[outputFrequency] int  outputFrequency,
[refreshIntervals] int  refreshIntervals,
[synchronousContext] bool  synchronousContext,
[monoSources] int  monoSources,
[stereoSources] int  stereoSources 
) [virtual]

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 ALContext::isExtensionPresent: ( NSString*  name) [virtual]

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 ALContext::notifySourceDeallocating: ( ALSource source) [virtual]

(INTERNAL USE) Used by ALSource to announce deallocation.

Parameters:
sourcethe source that is deallocating.
void ALContext::notifySourceInitializing: ( ALSource source) [virtual]

(INTERNAL USE) Used by ALSource to announce initialization.

Parameters:
sourcethe source that is initializing.
void ALContext::process ( ) [virtual]

Process this context.

void ALContext::stopAllSounds ( ) [virtual]

Stop all sound sources in this context.


Member Data Documentation

NSMutableArray* ALContext::attributes [protected]

This context's attributes.

NSMutableArray* ALContext::sources [protected]

All sound sources associated with this context.

bool ALContext::suspended [protected]

If YES, this object is suspended.

Reimplemented from <OALSuspendManager>.

Handles suspending and interrupting for this object.


Property Documentation

NSString * ALContext::alVersion [read, assign]

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

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

NSArray* ALContext::attributes [read, assign]

The current context's attribute list.

Only valid when this is the current context.

ALCcontext * ALContext::context [read, assign]

The OpenAL context pointer.

ALDevice * ALContext::device [read, assign]

The device this context was opened on.

ALenum ALContext::distanceModel [read, write, assign]

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 ALContext::dopplerFactor [read, write, assign]

Exaggeration factor for Doppler effect.

Only valid when this is the current context.

NSArray * ALContext::extensions [read, assign]

List of available extensions (NSString*).

Only valid when this is the current context.

ALListener * ALContext::listener [read, assign]

This context's listener.

NSString * ALContext::renderer [read, assign]

Information about the specific renderer.

Only valid when this is the current context.

NSArray* ALContext::sources [read, assign]

All sources associated with this context (ALSource*).

float ALContext::speedOfSound [read, write, assign]

Speed of sound in same units as velocities.

Only valid when this is the current context.

NSString * ALContext::vendor [read, assign]

Name of the vendor.

Only valid when this is the current context.


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