#import <CDAudioManager.h>
Inherits CDLongAudioSourceDelegate-p, and CDAudioInterruptProtocol-p.
Public Member Functions | |
| (id) | - init: |
| (BOOL) | - isDeviceMuted |
| (BOOL) | - isOtherAudioPlaying |
| (void) | - setMode: |
| (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 |
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 136 of file CDAudioManager.h.
| - (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 .mp3 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