CDAudioManager manages audio requirements for a game. More...
#import <CDAudioManager.h>
Instance Methods | |
(id) | - init: |
Initializes the engine synchronously with a mode, channel definition and a total number of channels. More... | |
(void) | - audioSessionInterrupted |
(void) | - audioSessionResumed |
(void) | - setResignBehavior:autoHandle: |
var | - setResignBehavior:autoHandle: |
local | - setResignBehavior:autoHandle: |
(BOOL) | - isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off. More... | |
(BOOL) | - isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player. More... | |
(void) | - setMode: |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch. More... | |
(void) | - applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active. More... | |
local | - applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active. More... | |
(void) | - applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active. More... | |
(CDLongAudioSource *) | - audioSourceLoad:channel: |
Loads the data from the specified file path to the channel's audio source. More... | |
(CDLongAudioSource *) | - audioSourceForChannel: |
Retrieves the audio source for the specified channel. More... | |
(void) | - playBackgroundMusic:loop: |
Plays music in background. More... | |
var | - playBackgroundMusic:loop: |
Plays music in background. More... | |
local | - playBackgroundMusic:loop: |
Plays music in background. More... | |
(void) | - preloadBackgroundMusic: |
Preloads a background music. More... | |
(void) | - stopBackgroundMusic |
Stops playing the background music. More... | |
(void) | - pauseBackgroundMusic |
Pauses the background music. More... | |
(void) | - rewindBackgroundMusic |
Rewinds the background music. More... | |
(void) | - resumeBackgroundMusic |
Resumes playing the background music. More... | |
(BOOL) | - isBackgroundMusicPlaying |
Returns whether or not the background music is playing. More... | |
(void) | - setBackgroundMusicCompletionListener:selector: |
(id) | - init: |
Initializes the engine synchronously with a mode, channel definition and a total number of channels. More... | |
(void) | - audioSessionInterrupted |
(void) | - audioSessionResumed |
(void) | - setResignBehavior:autoHandle: |
local | - setResignBehavior:autoHandle: |
(BOOL) | - isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off. More... | |
(BOOL) | - isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player. More... | |
(void) | - setMode: |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch. More... | |
(void) | - applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active. More... | |
(void) | - applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active. More... | |
(CDLongAudioSource *) | - audioSourceLoad:channel: |
Loads the data from the specified file path to the channel's audio source. More... | |
(CDLongAudioSource *) | - audioSourceForChannel: |
Retrieves the audio source for the specified channel. More... | |
(void) | - playBackgroundMusic:loop: |
Plays music in background. More... | |
var | - playBackgroundMusic:loop: |
Plays music in background. More... | |
local | - playBackgroundMusic:loop: |
Plays music in background. More... | |
(void) | - preloadBackgroundMusic: |
Preloads a background music. More... | |
(void) | - stopBackgroundMusic |
Stops playing the background music. More... | |
(void) | - pauseBackgroundMusic |
Pauses the background music. More... | |
(void) | - rewindBackgroundMusic |
Rewinds the background music. More... | |
(void) | - resumeBackgroundMusic |
Resumes playing the background music. More... | |
(BOOL) | - isBackgroundMusicPlaying |
Returns whether or not the background music is playing. More... | |
(void) | - setBackgroundMusicCompletionListener:selector: |
Instance Methods inherited from <CDLongAudioSourceDelegate> | |
(void) | - cdAudioSourceDidFinishPlaying: |
The audio source completed playing. More... | |
(void) | - cdAudioSourceFileDidChange: |
The file used to load the audio source has changed. More... | |
(void) | - cdAudioSourceDidFinishPlaying: |
The audio source completed playing. More... | |
var | - cdAudioSourceDidFinishPlaying: |
The audio source completed playing. More... | |
local | - cdAudioSourceDidFinishPlaying: |
The audio source completed playing. More... | |
(void) | - cdAudioSourceFileDidChange: |
The file used to load the audio source has changed. More... | |
Instance Methods inherited from <CDAudioInterruptProtocol> | |
(BOOL) | - mute |
Is audio mute. More... | |
(void) | - setMute: |
If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. More... | |
(BOOL) | - enabled |
Is audio enabled. More... | |
(void) | - setEnabled: |
If NO then all audio is stopped and any calls to start new audio will be ignored. More... | |
(BOOL) | - mute |
Is audio mute. More... | |
(void) | - setMute: |
If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. More... | |
local | - setMute: |
If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. More... | |
(BOOL) | - enabled |
Is audio enabled. More... | |
(void) | - setEnabled: |
If NO then all audio is stopped and any calls to start new audio will be ignored. More... | |
Class Methods | |
(CDAudioManager *) | + sharedManager |
Returns the shared singleton. More... | |
(tAudioManagerState) | + sharedManagerState |
(void) | + configure: |
Configures the shared singleton with a mode. More... | |
(void) | + initAsynchronously: |
Initializes the engine asynchronously with a mode. More... | |
(void) | + end |
Shuts down the shared audio manager instance so that it can be reinitialised. More... | |
(CDAudioManager *) | + sharedManager |
Returns the shared singleton. More... | |
var | + sharedManager |
Returns the shared singleton. More... | |
(tAudioManagerState) | + sharedManagerState |
local | + sharedManagerState |
(void) | + configure: |
Configures the shared singleton with a mode. More... | |
(void) | + initAsynchronously: |
Initializes the engine asynchronously with a mode. More... | |
(void) | + end |
Shuts down the shared audio manager instance so that it can be reinitialised. More... | |
Protected Attributes | |
NSMutableArray * | audioSourceChannels |
var | audioSourceChannels |
local | audioSourceChannels |
NSString * | _audioSessionCategory |
BOOL | _audioWasPlayingAtStartup |
tAudioManagerMode | _mode |
SEL | backgroundMusicCompletionSelector |
id | backgroundMusicCompletionListener |
BOOL | _mute |
BOOL | _resigned |
BOOL | _interrupted |
BOOL | _audioSessionActive |
BOOL | enabled_ |
BOOL | _isObservingAppEvents |
tAudioManagerResignBehavior | _resignBehavior |
Properties | |
CDSoundEngine * | soundEngine |
CDLongAudioSource * | backgroundMusic |
BOOL | willPlayBackgroundMusic |
CDAudioManager manages audio requirements for a game.
It provides access to a CDSoundEngine object for playing sound effects. It provides access to two CDLongAudioSource object (left and right channel) for playing long duration audio such as background music and narration tracks. Additionally it manages the audio session to take care of things like audio session interruption and interacting with the audio of other apps that are running on the device.
Requirements:
- (void) applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
var applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
local applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
- (void) applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
var applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
local applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
- (void) applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
var applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
local applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
- (void) applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
var applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
local applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
- (void) audioSessionInterrupted |
var audioSessionInterrupted |
local audioSessionInterrupted |
- (void) audioSessionInterrupted |
var audioSessionInterrupted |
local audioSessionInterrupted |
- (void) audioSessionResumed |
var audioSessionResumed |
local audioSessionResumed |
- (void) audioSessionResumed |
var audioSessionResumed |
local audioSessionResumed |
- (CDLongAudioSource*) audioSourceForChannel: |
(tAudioSourceChannel) | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: |
var | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: |
local | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: |
(tAudioSourceChannel) | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: |
var | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: |
local | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceLoad: |
(NSString *) | filePath | |
channel: | (tAudioSourceChannel) | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource*) audioSourceLoad: |
var | filePath | |
channel: | var | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource*) audioSourceLoad: |
local | filePath | |
channel: | local | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource*) audioSourceLoad: |
(NSString *) | filePath | |
channel: | (tAudioSourceChannel) | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource*) audioSourceLoad: |
var | filePath | |
channel: | var | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource*) audioSourceLoad: |
local | filePath | |
channel: | local | channel | |
Loads the data from the specified file path to the channel's audio source.
+ (void) configure: | (tAudioManagerMode) | mode |
Configures the shared singleton with a mode.
+ (void) configure: | var | mode |
Configures the shared singleton with a mode.
+ (void) configure: | local | mode |
Configures the shared singleton with a mode.
+ (void) configure: | (tAudioManagerMode) | mode |
Configures the shared singleton with a mode.
+ (void) configure: | var | mode |
Configures the shared singleton with a mode.
+ (void) configure: | local | mode |
Configures the shared singleton with a mode.
+ (void) end |
Shuts down the shared audio manager instance so that it can be reinitialised.
var end |
Shuts down the shared audio manager instance so that it can be reinitialised.
local end |
Shuts down the shared audio manager instance so that it can be reinitialised.
+ (void) end |
Shuts down the shared audio manager instance so that it can be reinitialised.
var end |
Shuts down the shared audio manager instance so that it can be reinitialised.
local end |
Shuts down the shared audio manager instance so that it can be reinitialised.
- (id) init: | (tAudioManagerMode) | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
- (id) init: | var | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
- (id) init: | local | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
- (id) init: | (tAudioManagerMode) | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
- (id) init: | var | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
- (id) init: | local | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | var | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | local | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | var | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | local | mode |
Initializes the engine asynchronously with a mode.
- (BOOL) isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
var isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
local isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
- (BOOL) isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
var isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
local isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
- (BOOL) isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
var isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
local isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
- (BOOL) isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
var isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
local isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
- (BOOL) isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
var isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
local isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
- (BOOL) isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
var isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
local isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
- (void) pauseBackgroundMusic |
Pauses the background music.
var pauseBackgroundMusic |
Pauses the background music.
local pauseBackgroundMusic |
Pauses the background music.
- (void) pauseBackgroundMusic |
Pauses the background music.
var pauseBackgroundMusic |
Pauses the background music.
local pauseBackgroundMusic |
Pauses the background music.
- (void) playBackgroundMusic: | (NSString *) | filePath | |
loop: | (BOOL) | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | var | filePath | |
loop: | var | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | local | filePath | |
loop: | local | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | (NSString *) | filePath | |
loop: | (BOOL) | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | var | filePath | |
loop: | var | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | local | filePath | |
loop: | local | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) preloadBackgroundMusic: | (NSString *) | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | var | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | local | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | (NSString *) | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | var | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | local | filePath |
Preloads a background music.
- (void) resumeBackgroundMusic |
Resumes playing the background music.
var resumeBackgroundMusic |
Resumes playing the background music.
local resumeBackgroundMusic |
Resumes playing the background music.
- (void) resumeBackgroundMusic |
Resumes playing the background music.
var resumeBackgroundMusic |
Resumes playing the background music.
local resumeBackgroundMusic |
Resumes playing the background music.
- (void) rewindBackgroundMusic |
Rewinds the background music.
var rewindBackgroundMusic |
Rewinds the background music.
local rewindBackgroundMusic |
Rewinds the background music.
- (void) rewindBackgroundMusic |
Rewinds the background music.
var rewindBackgroundMusic |
Rewinds the background music.
local rewindBackgroundMusic |
Rewinds the background music.
- (void) setBackgroundMusicCompletionListener: |
(id) | listener | |
selector: | (SEL) | selector | |
- (void) setBackgroundMusicCompletionListener: |
var | listener | |
selector: | var | selector | |
- (void) setBackgroundMusicCompletionListener: |
local | listener | |
selector: | local | selector | |
- (void) setBackgroundMusicCompletionListener: |
(id) | listener | |
selector: | (SEL) | selector | |
- (void) setBackgroundMusicCompletionListener: |
var | listener | |
selector: | var | selector | |
- (void) setBackgroundMusicCompletionListener: |
local | listener | |
selector: | local | selector | |
- (void) setMode: | (tAudioManagerMode) | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | var | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | local | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | (tAudioManagerMode) | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | var | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | local | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
- (void) setResignBehavior: | var | resignBehavior | |
autoHandle: | var | autoHandle | |
- (void) setResignBehavior: | local | resignBehavior | |
autoHandle: | local | autoHandle | |
- (void) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
- (void) setResignBehavior: | var | resignBehavior | |
autoHandle: | var | autoHandle | |
- (void) setResignBehavior: | local | resignBehavior | |
autoHandle: | local | autoHandle | |
+ (CDAudioManager *) sharedManager |
Returns the shared singleton.
var sharedManager |
Returns the shared singleton.
local sharedManager |
Returns the shared singleton.
+ (CDAudioManager *) sharedManager |
Returns the shared singleton.
var sharedManager |
Returns the shared singleton.
local sharedManager |
Returns the shared singleton.
+ (tAudioManagerState) sharedManagerState |
var sharedManagerState |
local sharedManagerState |
+ (tAudioManagerState) sharedManagerState |
var sharedManagerState |
local sharedManagerState |
- (void) stopBackgroundMusic |
Stops playing the background music.
var stopBackgroundMusic |
Stops playing the background music.
local stopBackgroundMusic |
Stops playing the background music.
- (void) stopBackgroundMusic |
Stops playing the background music.
var stopBackgroundMusic |
Stops playing the background music.
local stopBackgroundMusic |
Stops playing the background music.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |