Public Member Functions | Static Public Member Functions | Properties

SimpleAudioEngine Class Reference

#import <SimpleAudioEngine.h>

Inherits CDAudioInterruptProtocol-p.

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

- (BOOL) isBackgroundMusicPlaying  

returns whether or not the background music is playing

- (void) pauseBackgroundMusic  

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

- (void) resumeBackgroundMusic  

resume background music that has been paused

- (void) rewindBackgroundMusic  

rewind the background music

+ (SimpleAudioEngine*) sharedEngine  

returns the shared instance of the SimpleAudioEngine object

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

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

- (void) stopBackgroundMusic  

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 34 of file SimpleAudioEngine.h.

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

Effects volume. Range is 0.0f to 1.0f

Definition at line 36 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 38 of file SimpleAudioEngine.h.


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

cocos2d for iPhone 0.99.4 API Reference - Generated using Doxygen 1.7.1