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

Manager class for OpenAL objects (ObjectAL). More...

#import <OpenALManager.h>

Inheritance diagram for OpenALManager:
<OALSuspendManager> <OALSuspendListener>

Instance Methods

(ALBuffer *) - bufferFromFile:
 Load an OpenAL buffer with the contents of an audio file. More...
 
(ALBuffer *) - bufferFromFile:reduceToMono:
 Load an OpenAL buffer with the contents of an audio file. More...
 
(ALBuffer *) - bufferFromUrl:
 Load an OpenAL buffer with the contents of an audio file. More...
 
(ALBuffer *) - bufferFromUrl:reduceToMono:
 Load an OpenAL buffer with the contents of an audio file. More...
 
(NSString *) - bufferAsyncFromFile:target:selector:
 Load an OpenAL buffer with the contents of an audio file asynchronously. More...
 
(NSString *) - bufferAsyncFromFile:reduceToMono:target:selector:
 Load an OpenAL buffer with the contents of an audio file asynchronously. More...
 
(NSString *) - bufferAsyncFromUrl:target:selector:
 Load an OpenAL buffer with the contents of a URL asynchronously. More...
 
(NSString *) - bufferAsyncFromUrl:reduceToMono:target:selector:
 Load an OpenAL buffer with the contents of a URL asynchronously. More...
 
(void) - clearAllBuffers
 Clear all references to sound data from ALL buffers, managed or not. 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...
 

Protected Member Functions

() - SYNTHESIZE_SINGLETON_FOR_CLASS_HEADER
 Singleton implementation providing "sharedInstance" and "purgeSharedInstance" methods. More...
 

Protected Attributes

NSMutableArray * devices
 All opened devices. More...
 
OALSuspendHandlersuspendHandler
 Handles suspending and interrupting for this object. More...
 
NSOperationQueue * operationQueue
 Operation queue for asynchronous loading. More...
 

Properties

NSArray * availableDevices
 List of available playback devices (NSString*). More...
 
NSArray * availableCaptureDevices
 List of available capture devices (NSString*). More...
 
ALContextcurrentContext
 The current context (some context operations require the context to be the "current" one). More...
 
NSString * defaultCaptureDeviceSpecifier
 Name of the default capture device. More...
 
NSString * defaultDeviceSpecifier
 Name of the default playback device. More...
 
NSArray * devices
 List of all open devices (ALDevice*). More...
 
ALdouble mixerOutputFrequency
 The frequency of the output mixer. More...
 
ALint renderingQuality
 The rendering quality. 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

Manager class for OpenAL objects (ObjectAL).

Keeps track of devices that have been opened, and allows high level OpenAL management.
Provides methods for loading ALBuffer objects from audio files.
The OpenAL 1.1 specification is available at http://connect.creativelabs.com/openal/Documentation
Be sure to read through it (especially the part about distance models) as ObjectAL follows the OpenAL object model.

Alternatively, you may opt to use OALSimpleAudio for a simpler interface.

Method Documentation

- (NSString *) bufferAsyncFromFile: (NSString*)  filePath
reduceToMono: (bool)  reduceToMono
target: (id)  target
selector: (SEL)  selector 

Load an OpenAL buffer with the contents of an audio file asynchronously.

This method will schedule a request to have the buffer created and filled, and then call the specified selector with the newly created buffer.
The buffer's name will be the fully qualified URL of the path.
Returns the fully qualified URL of the path, which you can match up to the buffer name in your callback method.

See the class description note regarding sound file formats.

Parameters
filePathThe path of the file containing the audio data.
reduceToMonoIf true, reduce the sample to mono (stereo samples don't support panning or positional audio).
targetThe target to call when the buffer is loaded.
selectorThe selector to invoke when the buffer is loaded.
Returns
The fully qualified URL of the path.
- (NSString *) bufferAsyncFromFile: (NSString*)  filePath
target: (id)  target
selector: (SEL)  selector 

Load an OpenAL buffer with the contents of an audio file asynchronously.

This method will schedule a request to have the buffer created and filled, and then call the specified selector with the newly created buffer.
The buffer's name will be the fully qualified URL of the path.
Returns the fully qualified URL of the path, which you can match up to the buffer name in your callback method.

See the class description note regarding sound file formats.

Parameters
filePathThe path of the file containing the audio data.
targetThe target to call when the buffer is loaded.
selectorThe selector to invoke when the buffer is loaded.
Returns
The fully qualified URL of the path.
- (NSString *) bufferAsyncFromUrl: (NSURL*)  url
reduceToMono: (bool)  reduceToMono
target: (id)  target
selector: (SEL)  selector 

Load an OpenAL buffer with the contents of a URL asynchronously.

This method will schedule a request to have the buffer created and filled, and then call the specified selector with the newly created buffer.
The buffer's name will be the fully qualified URL.
Returns the fully qualified URL, which you can match up to the buffer name in your callback method.

See the class description note regarding sound file formats.

Parameters
urlThe URL of the file containing the audio data.
reduceToMonoIf true, reduce the sample to mono (stereo samples don't support panning or positional audio).
targetThe target to call when the buffer is loaded.
selectorThe selector to invoke when the buffer is loaded.
Returns
The fully qualified URL of the path.
- (NSString *) bufferAsyncFromUrl: (NSURL*)  url
target: (id)  target
selector: (SEL)  selector 

Load an OpenAL buffer with the contents of a URL asynchronously.

This method will schedule a request to have the buffer created and filled, and then call the specified selector with the newly created buffer.
The buffer's name will be the fully qualified URL.
Returns the fully qualified URL, which you can match up to the buffer name in your callback method.

See the class description note regarding sound file formats.

Parameters
urlThe URL of the file containing the audio data.
targetThe target to call when the buffer is loaded.
selectorThe selector to invoke when the buffer is loaded.
Returns
The fully qualified URL of the path.
- (ALBuffer *) bufferFromFile: (NSString*)  filePath

Load an OpenAL buffer with the contents of an audio file.

The buffer's name will be the fully qualified URL of the path.

See the class description note regarding sound file formats.

Parameters
filePathThe path of the file containing the audio data.
Returns
An ALBuffer containing the audio data.
- (ALBuffer *) bufferFromFile: (NSString*)  filePath
reduceToMono: (bool)  reduceToMono 

Load an OpenAL buffer with the contents of an audio file.

The buffer's name will be the fully qualified URL of the path.

See the class description note regarding sound file formats.

Parameters
filePathThe path of the file containing the audio data.
reduceToMonoIf true, reduce the sample to mono (stereo samples don't support panning or positional audio).
Returns
An ALBuffer containing the audio data.
- (ALBuffer *) bufferFromUrl: (NSURL*)  url

Load an OpenAL buffer with the contents of an audio file.

The buffer's name will be the fully qualified URL.

See the class description note regarding sound file formats.

Parameters
urlThe URL of the file containing the audio data.
Returns
An ALBuffer containing the audio data.
- (ALBuffer *) bufferFromUrl: (NSURL*)  url
reduceToMono: (bool)  reduceToMono 

Load an OpenAL buffer with the contents of an audio file.

The buffer's name will be the fully qualified URL.

See the class description note regarding sound file formats.

Parameters
urlThe URL of the file containing the audio data.
reduceToMonoIf true, reduce the sample to mono (stereo samples don't support panning or positional audio).
Returns
An ALBuffer containing the audio data.
- (void) clearAllBuffers

Clear all references to sound data from ALL buffers, managed or not.

- OpenALManager: (OpenALManager

Singleton implementation providing "sharedInstance" and "purgeSharedInstance" methods.

- (OpenALManager*) sharedInstance: Get the shared singleton instance.
- (void) purgeSharedInstance: Purge (deallocate) the shared instance.

Member Data Documentation

- (NSMutableArray*) devices
protected

All opened devices.

- (NSOperationQueue*) operationQueue
protected

Operation queue for asynchronous loading.

- (OALSuspendHandler*) suspendHandler
protected

Handles suspending and interrupting for this object.

Property Documentation

- (NSArray *) availableCaptureDevices
readnonatomicretain

List of available capture devices (NSString*).

- (NSArray *) availableDevices
readnonatomicretain

List of available playback devices (NSString*).

- (ALContext *) currentContext
readwritenonatomicassign

The current context (some context operations require the context to be the "current" one).

WEAK reference.

- (NSString *) defaultCaptureDeviceSpecifier
readnonatomicretain

Name of the default capture device.

- (NSString *) defaultDeviceSpecifier
readnonatomicretain

Name of the default playback device.

- (NSArray*) devices
readnonatomicretain

List of all open devices (ALDevice*).

- (ALdouble) mixerOutputFrequency
readwritenonatomicassign

The frequency of the output mixer.

- (ALint) renderingQuality
readwritenonatomicassign

The rendering quality.

Can be one of:

  • ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH
  • ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW
  • ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES (iOS only)

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