CocosDenshion iOS  1.0.1
CocosDenshion API Reference (iOS version) for Kobold2D developers
CDAudioManager Interface Reference

#include <CDAudioManager.h>

Inheritance diagram for CDAudioManager:
Collaboration diagram for CDAudioManager:

List of all members.

Public Member Functions

id init: (tAudioManagerMode mode)
void audioSessionInterrupted ()
void audioSessionResumed ()
void setResignBehavior:autoHandle: (tAudioManagerResignBehavior resignBehavior,[autoHandle] BOOL autoHandle)
BOOL isDeviceMuted ()
BOOL isOtherAudioPlaying ()
void setMode: (tAudioManagerMode mode)
void applicationWillResignActive ()
void applicationDidBecomeActive ()
CDLongAudioSourceaudioSourceLoad:channel: (NSString *filePath,[channel] tAudioSourceChannel channel)
CDLongAudioSourceaudioSourceForChannel: (tAudioSourceChannel channel)
void playBackgroundMusic:loop: (NSString *filePath,[loop] BOOL loop)
void preloadBackgroundMusic: (NSString *filePath)
void stopBackgroundMusic ()
void pauseBackgroundMusic ()
void rewindBackgroundMusic ()
void resumeBackgroundMusic ()
BOOL isBackgroundMusicPlaying ()
void setBackgroundMusicCompletionListener:selector: (id listener,[selector] SEL selector)

Static Public Member Functions

CDAudioManagersharedManager ()
tAudioManagerState sharedManagerState ()
void configure: (tAudioManagerMode mode)
void initAsynchronously: (tAudioManagerMode mode)
void end ()

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

CDSoundEnginesoundEngine
CDLongAudioSourcebackgroundMusic
BOOL willPlayBackgroundMusic

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:

  • Firmware: OS 2.2 or greater
  • Files: CDAudioManager.*, CocosDenshion.*
  • Frameworks: OpenAL, AudioToolbox, AVFoundation
    Since:
    v0.8

Member Function Documentation

void CDAudioManager::applicationDidBecomeActive ( ) [virtual]

Call if you want to use built in resign behavior but need to do some additional audio processing on become active.

void CDAudioManager::applicationWillResignActive ( ) [virtual]

Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.

CDLongAudioSource* CDAudioManager::audioSourceForChannel: ( tAudioSourceChannel  channel) [virtual]

Retrieves the audio source for the specified channel

CDLongAudioSource* CDAudioManager::audioSourceLoad:channel: ( NSString *  filePath,
[channel] tAudioSourceChannel  channel 
) [virtual]

Loads the data from the specified file path to the channel's audio source

void CDAudioManager::configure: ( tAudioManagerMode  mode) [static, virtual]

Configures the shared singleton with a mode

void CDAudioManager::end ( ) [static, virtual]

Shuts down the shared audio manager instance so that it can be reinitialised

id CDAudioManager::init: ( tAudioManagerMode  mode) [virtual]

Initializes the engine synchronously with a mode, channel definition and a total number of channels

void CDAudioManager::initAsynchronously: ( tAudioManagerMode  mode) [static, virtual]

Initializes the engine asynchronously with a mode

BOOL CDAudioManager::isBackgroundMusicPlaying ( ) [virtual]

Returns whether or not the background music is playing

BOOL CDAudioManager::isDeviceMuted ( ) [virtual]

Returns true is audio is muted at a hardware level e.g user has ringer switch set to off

BOOL CDAudioManager::isOtherAudioPlaying ( ) [virtual]

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

void CDAudioManager::pauseBackgroundMusic ( ) [virtual]

Pauses the background music

void CDAudioManager::playBackgroundMusic:loop: ( NSString *  filePath,
[loop] BOOL  loop 
) [virtual]

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 CDAudioManager::preloadBackgroundMusic: ( NSString *  filePath) [virtual]

Preloads a background music

void CDAudioManager::resumeBackgroundMusic ( ) [virtual]

Resumes playing the background music

void CDAudioManager::rewindBackgroundMusic ( ) [virtual]

Rewinds the background music

void CDAudioManager::setMode: ( tAudioManagerMode  mode) [virtual]

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 * CDAudioManager::sharedManager ( ) [static, virtual]

Returns the shared singleton

void CDAudioManager::stopBackgroundMusic ( ) [virtual]

Stops playing the background music


The documentation for this interface was generated from the following file: