cocos2d for iPhone 1.0.0
2D engine for iOS and OS X
Public Member Functions | Static Public Member Functions
CDAudioManager Class Reference

#import <CDAudioManager.h>

Inherits <CDLongAudioSourceDelegate>, and <CDAudioInterruptProtocol>.

List of all members.

Public Member Functions

(id) - init:
(BOOL) - isDeviceMuted
(BOOL) - isOtherAudioPlaying
(void) - setMode:
(void) - applicationWillResignActive
(void) - applicationDidBecomeActive
(CDLongAudioSource *) - audioSourceLoad:channel:
(CDLongAudioSource *) - audioSourceForChannel:
(void) - playBackgroundMusic:loop:
(void) - preloadBackgroundMusic:
(void) - stopBackgroundMusic
(void) - pauseBackgroundMusic
(void) - rewindBackgroundMusic
(void) - resumeBackgroundMusic
(BOOL) - isBackgroundMusicPlaying

Static Public Member Functions

(CDAudioManager *) + sharedManager
(void) + configure:
(void) + initAsynchronously:
(void) + end

Detailed Description

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:

Definition at line 145 of file CDAudioManager.h.


Member Function Documentation

- (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.

- (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

+ (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

- (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

- (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) isOtherAudioPlaying

Returns true if another app is playing audio such as the iPod music player

- (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) preloadBackgroundMusic: (NSString *)  filePath

Preloads a background music

- (void) resumeBackgroundMusic

Resumes playing the background music

- (void) rewindBackgroundMusic

Rewinds the background music

- (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

+ (CDAudioManager *) sharedManager

Returns the shared singleton

- (void) stopBackgroundMusic

Stops playing the background music


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines

cocos2d for iPhone API Reference - Generated using Doxygen 1.7.4