ALContext Class Reference
| Inherits from | NSObject |
| Conforms to | OALSuspendManager |
| Declared in | ALContext.h |
Overview
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.
Tasks
-
alVersionOpenAL version string in format “[spec major number].[spec minor number] [optional vendor version information]” Only valid when this is the current context.
property -
attributesThe current context’s attribute list. Only valid when this is the current context.
property -
contextThe OpenAL context pointer.
property -
deviceThe device this context was opened on.
property -
distanceModelThe 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.
property
Only valid when this is the current context. -
dopplerFactorExaggeration factor for Doppler effect. Only valid when this is the current context.
property -
extensionsList of available extensions (NSString*). Only valid when this is the current context.
property -
listenerThis context’s listener.
property -
rendererInformation about the specific renderer. Only valid when this is the current context.
property -
sourcesAll sources associated with this context (ALSource*).
property -
speedOfSoundSpeed of sound in same units as velocities. Only valid when this is the current context.
property -
vendorName of the vendor. Only valid when this is the current context.
property -
+ contextOnDevice:attributes:Create a new context on the specified device.
-
+ contextOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:Create a new context on the specified device with attributes.
-
– initOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:Initialize this context on the specified device with attributes.
-
– initOnDevice:attributes:Initialize this context for the specified device and attributes.
-
– processProcess this context.
-
– stopAllSoundsStop all sound sources in this context.
-
– clearBuffersClear all buffers being used by sources in this context.
-
– ensureContextIsCurrentMake 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.
-
– isExtensionPresent:Check if the specified extension is present in this context. Only valid when this is the current context.
-
– getProcAddress: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. -
– notifySourceInitializing:(INTERNAL USE) Used by ALSource to announce initialization.
-
– notifySourceDeallocating:(INTERNAL USE) Used by ALSource to announce deallocation.
Properties
alVersion
OpenAL version string in format “[spec major number].[spec minor number] [optional vendor version information]” Only valid when this is the current context.
@property (nonatomic, readonly) NSString *alVersionDeclared In
ALContext.hattributes
The current context’s attribute list. Only valid when this is the current context.
@property (nonatomic, readonly) NSArray *attributesDeclared In
ALContext.hcontext
The OpenAL context pointer.
@property (nonatomic, readonly) ALCcontext *contextDeclared In
ALContext.hdevice
The device this context was opened on.
@property (nonatomic, readonly) ALDevice *deviceDeclared In
ALContext.hdistanceModel
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.
@property (readwrite, assign) ALenum distanceModelDeclared In
ALContext.hdopplerFactor
Exaggeration factor for Doppler effect. Only valid when this is the current context.
@property (readwrite, assign) float dopplerFactorDeclared In
ALContext.hextensions
List of available extensions (NSString*). Only valid when this is the current context.
@property (nonatomic, readonly) NSArray *extensionsDeclared In
ALContext.hlistener
This context’s listener.
@property (nonatomic, readonly) ALListener *listenerDeclared In
ALContext.hrenderer
Information about the specific renderer. Only valid when this is the current context.
@property (nonatomic, readonly) NSString *rendererDeclared In
ALContext.hsources
All sources associated with this context (ALSource*).
@property (nonatomic, readonly) NSArray *sourcesDeclared In
ALContext.hClass Methods
contextOnDevice:attributes:
Create a new context on the specified device.
+ (id)contextOnDevice:(ALDevice *)device attributes:(NSArray *)attributesParameters
- device
The device to open the context on.
- attributes
An 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
Return Value
A new context.
Declared In
ALContext.hcontextOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:
Create a new context on the specified device with attributes.
+ (id)contextOnDevice:(ALDevice *)device outputFrequency:(int)outputFrequency refreshIntervals:(int)refreshIntervals synchronousContext:(bool)synchronousContext monoSources:(int)monoSources stereoSources:(int)stereoSourcesParameters
- device
The device to open the context on.
- outputFrequency
The frequency to mix all sources to before outputting (ignored by iOS).
- refreshIntervals
The 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).
- synchronousContext
If true, this context runs on the main thread and depends on you calling alcUpdateContext (ignored by iOS).
- monoSources
A hint indicating how many sources should support mono (default 28 on iOS).
- stereoSources
A hint indicating how many sources should support stereo (default 4 on iOS).
Return Value
A new context.
Declared In
ALContext.hInstance Methods
clearBuffers
Clear all buffers being used by sources in this context.
- (void)clearBuffersDeclared In
ALContext.hensureContextIsCurrent
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)ensureContextIsCurrentDeclared In
ALContext.hgetProcAddress:
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.
- (void *)getProcAddress:(NSString *)functionNameParameters
- functionName
the name of the procedure to get.
Return Value
the procedure’s address, or NULL if it wasn’t found.
Declared In
ALContext.hinitOnDevice:attributes:
Initialize this context for the specified device and attributes.
- (id)initOnDevice:(ALDevice *)device attributes:(NSArray *)attributesParameters
- device
The device to open the context on.
- attributes
An 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
Return Value
The initialized context.
Declared In
ALContext.hinitOnDevice:outputFrequency:refreshIntervals:synchronousContext:monoSources:stereoSources:
Initialize this context on the specified device with attributes.
- (id)initOnDevice:(ALDevice *)device outputFrequency:(int)outputFrequency refreshIntervals:(int)refreshIntervals synchronousContext:(bool)synchronousContext monoSources:(int)monoSources stereoSources:(int)stereoSourcesParameters
- device
The device to open the context on.
- outputFrequency
The frequency to mix all sources to before outputting (ignored by iOS).
- refreshIntervals
The 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).
- synchronousContext
If true, this context runs on the main thread and depends on you calling alcUpdateContext (ignored by iOS).
- monoSources
A hint indicating how many sources should support mono (default 28 on iOS).
- stereoSources
A hint indicating how many sources should support stereo (default 4 on iOS).
Return Value
The initialized context.
Declared In
ALContext.hisExtensionPresent:
Check if the specified extension is present in this context. Only valid when this is the current context.
- (bool)isExtensionPresent:(NSString *)nameParameters
- name
The name of the extension to check.
Return Value
TRUE if the extension is present in this context.
Declared In
ALContext.hnotifySourceDeallocating:
(INTERNAL USE) Used by ALSource to announce deallocation.
- (void)notifySourceDeallocating:(ALSource *)sourceParameters
- source
the source that is deallocating.
Declared In
ALContext.h