cocos2d-x
3.3
|
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: |
(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... | |
(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: |
(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... | |
(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: |
![]() | |
(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... | |
(void) | - cdAudioSourceFileDidChange: |
The file used to load the audio source has changed. 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... | |
(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... | |
(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... | |
(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... | |
Protected Attributes | |
NSMutableArray * | 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.
- (void) 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.
- (void) applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
- (void) audioSessionInterrupted |
- (void) audioSessionInterrupted |
- (void) audioSessionResumed |
- (void) audioSessionResumed |
- (CDLongAudioSource*) audioSourceForChannel: | (tAudioSourceChannel) | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource*) audioSourceForChannel: | (tAudioSourceChannel) | 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: | (NSString *) | filePath | |
channel: | (tAudioSourceChannel) | 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: | (tAudioManagerMode) | mode |
Configures the shared singleton with a mode.
+ (void) 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.
- (id) init: | (tAudioManagerMode) | 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.
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
Initializes the engine asynchronously with a mode.
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
Initializes the engine asynchronously with a mode.
- (BOOL) isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
- (BOOL) 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.
- (BOOL) 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.
- (BOOL) isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
- (void) pauseBackgroundMusic |
Pauses the background music.
- (void) 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: | (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) preloadBackgroundMusic: | (NSString *) | filePath |
Preloads a background music.
- (void) preloadBackgroundMusic: | (NSString *) | filePath |
Preloads a background music.
- (void) resumeBackgroundMusic |
Resumes playing the background music.
- (void) resumeBackgroundMusic |
Resumes playing the background music.
- (void) rewindBackgroundMusic |
Rewinds the background music.
- (void) rewindBackgroundMusic |
Rewinds the background music.
- (void) setBackgroundMusicCompletionListener: | (id) | listener | |
selector: | (SEL) | selector | |
- (void) setBackgroundMusicCompletionListener: | (id) | listener | |
selector: | (SEL) | 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: | (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) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
- (void) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
+ (CDAudioManager *) sharedManager |
Returns the shared singleton.
+ (CDAudioManager *) sharedManager |
Returns the shared singleton.
+ (tAudioManagerState) sharedManagerState |
+ (tAudioManagerState) sharedManagerState |
- (void) stopBackgroundMusic |
Stops playing the background music.
- (void) stopBackgroundMusic |
Stops playing the background music.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
readatomicassign |
|
readatomicassign |
|
readatomicassign |