cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SimpleAudioEngine Class Reference

A wrapper to the CDAudioManager object. More...

#import <SimpleAudioEngine_objc.h>

Inheritance diagram for SimpleAudioEngine:
<CDAudioInterruptProtocol> <CDAudioInterruptProtocol>

Instance Methods

(void) - preloadBackgroundMusic:
 Preloads a music file so it will be ready to play as background music. More...
 
(void) - playBackgroundMusic:
 plays background music in a loop More...
 
(void) - playBackgroundMusic:loop:
 plays background music, if loop is true the music will repeat otherwise it will be played once More...
 
(void) - stopBackgroundMusic
 stops playing background music More...
 
(void) - pauseBackgroundMusic
 pauses the background music More...
 
(void) - resumeBackgroundMusic
 resume background music that has been paused More...
 
(void) - rewindBackgroundMusic
 rewind the background music More...
 
(BOOL) - isBackgroundMusicPlaying
 returns whether or not the background music is playing More...
 
(ALuint) - playEffect:loop:
 plays an audio effect with a file path More...
 
(void) - stopEffect:
 stop a sound that is playing, note you must pass in the soundId that is returned when you started playing the sound with playEffect More...
 
(ALuint) - playEffect:loop:pitch:pan:gain:
 plays an audio effect with a file path, pitch, pan and gain More...
 
(void) - pauseEffect:
 pause an audio More...
 
(void) - pauseAllEffects
 pause all audioes More...
 
(void) - resumeEffect:
 resume an audio More...
 
(void) - resumeAllEffects
 resume all audioes More...
 
(void) - stopAllEffects
 stop all audioes More...
 
(void) - preloadEffect:
 preloads an audio effect More...
 
(void) - unloadEffect:
 unloads an audio effect from memory More...
 
(CDSoundSource *) - soundSourceForFile:
 Gets a CDSoundSource object set up to play the specified file. More...
 
(void) - preloadBackgroundMusic:
 Preloads a music file so it will be ready to play as background music. More...
 
(void) - playBackgroundMusic:
 plays background music in a loop More...
 
(void) - playBackgroundMusic:loop:
 plays background music, if loop is true the music will repeat otherwise it will be played once More...
 
(void) - stopBackgroundMusic
 stops playing background music More...
 
(void) - pauseBackgroundMusic
 pauses the background music More...
 
(void) - resumeBackgroundMusic
 resume background music that has been paused More...
 
(void) - rewindBackgroundMusic
 rewind the background music More...
 
(BOOL) - isBackgroundMusicPlaying
 returns whether or not the background music is playing More...
 
(ALuint) - playEffect:loop:
 plays an audio effect with a file path More...
 
(void) - stopEffect:
 stop a sound that is playing, note you must pass in the soundId that is returned when you started playing the sound with playEffect More...
 
(ALuint) - playEffect:loop:pitch:pan:gain:
 plays an audio effect with a file path, pitch, pan and gain More...
 
(void) - pauseEffect:
 pause an audio More...
 
(void) - pauseAllEffects
 pause all audioes More...
 
(void) - resumeEffect:
 resume an audio More...
 
(void) - resumeAllEffects
 resume all audioes More...
 
(void) - stopAllEffects
 stop all audioes More...
 
(void) - preloadEffect:
 preloads an audio effect More...
 
(void) - unloadEffect:
 unloads an audio effect from memory More...
 
(CDSoundSource *) - soundSourceForFile:
 Gets a CDSoundSource object set up to play the specified file. More...
 
- Instance Methods inherited from <CDAudioInterruptProtocol>
(BOOL) - mute
 Is audio mute. More...
 
(void) - setMute:
 If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. More...
 
(BOOL) - enabled
 Is audio enabled. More...
 
(void) - setEnabled:
 If NO then all audio is stopped and any calls to start new audio will be ignored. More...
 
(BOOL) - mute
 Is audio mute. More...
 
(void) - setMute:
 If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. More...
 
(BOOL) - enabled
 Is audio enabled. More...
 
(void) - setEnabled:
 If NO then all audio is stopped and any calls to start new audio will be ignored. More...
 

Class Methods

(SimpleAudioEngine *) + sharedEngine
 returns the shared instance of the SimpleAudioEngine object More...
 
(void) + end
 Shuts down the shared audio engine instance so that it can be reinitialised. More...
 
(SimpleAudioEngine *) + sharedEngine
 returns the shared instance of the SimpleAudioEngine object More...
 
(void) + end
 Shuts down the shared audio engine instance so that it can be reinitialised. More...
 

Protected Attributes

BOOL mute_
 
BOOL enabled_
 

Properties

float backgroundMusicVolume
 Background music volume. More...
 
float effectsVolume
 Effects volume. More...
 
BOOL willPlayBackgroundMusic
 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. More...
 

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:

Method Documentation

+ (void) end

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

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

- (BOOL) isBackgroundMusicPlaying

returns whether or not the background music is playing

- (void) pauseAllEffects

pause all audioes

- (void) pauseAllEffects

pause all audioes

- (void) pauseBackgroundMusic

pauses the background music

- (void) pauseBackgroundMusic

pauses the background music

- (void) pauseEffect: (ALuint)  soundId

pause an audio

- (void) pauseEffect: (ALuint)  soundId

pause an audio

- (void) playBackgroundMusic: (NSString *)  filePath

plays background music in a loop

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

- (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
loop: (BOOL)  loop 

plays an audio effect with a file path

- (ALuint) playEffect: (NSString *)  filePath
loop: (BOOL)  loop 

plays an audio effect with a file path

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

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

- (ALuint) playEffect: (NSString *)  filePath
loop: (BOOL)  loop
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) 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) preloadEffect: (NSString *)  filePath

preloads an audio effect

- (void) resumeAllEffects

resume all audioes

- (void) resumeAllEffects

resume all audioes

- (void) resumeBackgroundMusic

resume background music that has been paused

- (void) resumeBackgroundMusic

resume background music that has been paused

- (void) resumeEffect: (ALuint)  soundId

resume an audio

- (void) resumeEffect: (ALuint)  soundId

resume an audio

- (void) rewindBackgroundMusic

rewind the background music

- (void) rewindBackgroundMusic

rewind the background music

+ (SimpleAudioEngine*) sharedEngine

returns the shared instance of the SimpleAudioEngine object

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

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

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

- (void) stopAllEffects

stop all audioes

- (void) stopAllEffects

stop all audioes

- (void) stopBackgroundMusic

stops playing background music

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

- (void) unloadEffect: (NSString *)  filePath

unloads an audio effect from memory

Member Data Documentation

- (BOOL) enabled_
protected
- (BOOL) mute_
protected

Property Documentation

- (float) backgroundMusicVolume
readwriteatomicassign

Background music volume.

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

- (float) effectsVolume
readwriteatomicassign

Effects volume.

Range is 0.0f to 1.0f

- (BOOL) willPlayBackgroundMusic
readatomicassign

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.


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