cocos2d for iPhone  2.0.0
2D game engine for iOS and OS X
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
Public Member Functions | Static Public Member Functions | Properties
SimpleAudioEngine Class Reference

#import <SimpleAudioEngine.h>

Inherits <CDAudioInterruptProtocol>.

List of all members.

Public Member Functions

(void) - preloadBackgroundMusic:
(void) - playBackgroundMusic:
(void) - playBackgroundMusic:loop:
(void) - stopBackgroundMusic
(void) - pauseBackgroundMusic
(void) - resumeBackgroundMusic
(void) - rewindBackgroundMusic
(BOOL) - isBackgroundMusicPlaying
(ALuint) - playEffect:
(void) - stopEffect:
(ALuint) - playEffect:pitch:pan:gain:
(void) - preloadEffect:
(void) - unloadEffect:
(CDSoundSource *) - soundSourceForFile:

Static Public Member Functions

(SimpleAudioEngine *) + sharedEngine
(void) + end

Properties

float backgroundMusicVolume
float effectsVolume
BOOL willPlayBackgroundMusic

Detailed Description

A wrapper to the CDAudioManager object. This is recommended for basic audio requirements. If you just want to play some sound fx and some background music and have no interest in learning the lower level workings then this is the interface to use.

Requirements:

Definition at line 40 of file SimpleAudioEngine.h.


Member Function Documentation

+ (void) end

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

returns whether or not the background music is playing

pauses the background music

- (void) playBackgroundMusic: (NSString *)  filePath

plays background music in a loop

- (void) playBackgroundMusic: (NSString *)  filePath
loop: (BOOL)  loop 

plays background music, if loop is true the music will repeat otherwise it will be played once

- (ALuint) playEffect: (NSString *)  filePath

plays an audio effect with a file path

- (ALuint) playEffect: (NSString *)  filePath
pitch: (Float32)  pitch
pan: (Float32)  pan
gain: (Float32)  gain 

plays an audio effect with a file path, pitch, pan and gain

- (void) preloadBackgroundMusic: (NSString *)  filePath

Preloads a music file so it will be ready to play as background music

- (void) preloadEffect: (NSString *)  filePath

preloads an audio effect

resume background music that has been paused

rewind the background music

returns the shared instance of the SimpleAudioEngine object

- (CDSoundSource *) soundSourceForFile: (NSString *)  filePath

Gets a CDSoundSource object set up to play the specified file.

stops playing background music

- (void) stopEffect: (ALuint)  soundId

stop a sound that is playing, note you must pass in the soundId that is returned when you started playing the sound with playEffect

- (void) unloadEffect: (NSString *)  filePath

unloads an audio effect from memory


Property Documentation

- (float) backgroundMusicVolume [read, write, assign]

Background music volume. Range is 0.0f to 1.0f. This will only have an effect if willPlayBackgroundMusic returns YES

Definition at line 47 of file SimpleAudioEngine.h.

- (float) effectsVolume [read, write, assign]

Effects volume. Range is 0.0f to 1.0f

Definition at line 49 of file SimpleAudioEngine.h.

- (BOOL) willPlayBackgroundMusic [read, assign]

If NO it indicates background music will not be played either because no background music is loaded or the audio session does not permit it.

Definition at line 51 of file SimpleAudioEngine.h.


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

cocos2d for iPhone API Reference - Generated using Doxygen 1.8.0