cocos2d-x  3.4
 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...
 
local - 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...
 
var - playEffect:loop:
 plays an audio effect with a file path More...
 
local - 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...
 
var - playEffect:loop:pitch:pan:gain:
 plays an audio effect with a file path, pitch, pan and gain More...
 
local - 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...
 
var - playEffect:loop:
 plays an audio effect with a file path More...
 
local - 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...
 
var - playEffect:loop:pitch:pan:gain:
 plays an audio effect with a file path, pitch, pan and gain More...
 
local - 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...
 
var - mute
 Is audio mute. More...
 
local - 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...
 
var - mute
 Is audio mute. More...
 
local - 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...
 
var + sharedEngine
 returns the shared instance of the SimpleAudioEngine object More...
 
local + 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...
 
var + sharedEngine
 returns the shared instance of the SimpleAudioEngine object More...
 
local + 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.

var end

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

local 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.

var end

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

local 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

var isBackgroundMusicPlaying

returns whether or not the background music is playing

local isBackgroundMusicPlaying

returns whether or not the background music is playing

- (BOOL) isBackgroundMusicPlaying

returns whether or not the background music is playing

var isBackgroundMusicPlaying

returns whether or not the background music is playing

local isBackgroundMusicPlaying

returns whether or not the background music is playing

- (void) pauseAllEffects

pause all audioes

var pauseAllEffects

pause all audioes

local pauseAllEffects

pause all audioes

- (void) pauseAllEffects

pause all audioes

var pauseAllEffects

pause all audioes

local pauseAllEffects

pause all audioes

- (void) pauseBackgroundMusic

pauses the background music

var pauseBackgroundMusic

pauses the background music

local pauseBackgroundMusic

pauses the background music

- (void) pauseBackgroundMusic

pauses the background music

var pauseBackgroundMusic

pauses the background music

local pauseBackgroundMusic

pauses the background music

- (void) pauseEffect: (ALuint)  soundId

pause an audio

- (void) pauseEffect: var  soundId

pause an audio

- (void) pauseEffect: local  soundId

pause an audio

- (void) pauseEffect: (ALuint)  soundId

pause an audio

- (void) pauseEffect: var  soundId

pause an audio

- (void) pauseEffect: local  soundId

pause an audio

- (void) playBackgroundMusic: (NSString *)  filePath

plays background music in a loop

- (void) playBackgroundMusic: var  filePath

plays background music in a loop

- (void) playBackgroundMusic: local  filePath

plays background music in a loop

- (void) playBackgroundMusic: (NSString *)  filePath

plays background music in a loop

- (void) playBackgroundMusic: var  filePath

plays background music in a loop

- (void) playBackgroundMusic: local  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: var  filePath
loop: var  loop 

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

- (void) playBackgroundMusic: local  filePath
loop: local  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

- (void) playBackgroundMusic: var  filePath
loop: var  loop 

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

- (void) playBackgroundMusic: local  filePath
loop: local  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: var  filePath
loop: var  loop 

plays an audio effect with a file path

- (ALuint) playEffect: local  filePath
loop: local  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: var  filePath
loop: var  loop 

plays an audio effect with a file path

- (ALuint) playEffect: local  filePath
loop: local  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: var  filePath
loop: var  loop
pitch: var  pitch
pan: var  pan
gain: var  gain 

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

- (ALuint) playEffect: local  filePath
loop: local  loop
pitch: local  pitch
pan: local  pan
gain: local  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

- (ALuint) playEffect: var  filePath
loop: var  loop
pitch: var  pitch
pan: var  pan
gain: var  gain 

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

- (ALuint) playEffect: local  filePath
loop: local  loop
pitch: local  pitch
pan: local  pan
gain: local  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: var  filePath

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

- (void) preloadBackgroundMusic: local  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) preloadBackgroundMusic: var  filePath

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

- (void) preloadBackgroundMusic: local  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: var  filePath

preloads an audio effect

- (void) preloadEffect: local  filePath

preloads an audio effect

- (void) preloadEffect: (NSString *)  filePath

preloads an audio effect

- (void) preloadEffect: var  filePath

preloads an audio effect

- (void) preloadEffect: local  filePath

preloads an audio effect

- (void) resumeAllEffects

resume all audioes

var resumeAllEffects

resume all audioes

local resumeAllEffects

resume all audioes

- (void) resumeAllEffects

resume all audioes

var resumeAllEffects

resume all audioes

local resumeAllEffects

resume all audioes

- (void) resumeBackgroundMusic

resume background music that has been paused

var resumeBackgroundMusic

resume background music that has been paused

local resumeBackgroundMusic

resume background music that has been paused

- (void) resumeBackgroundMusic

resume background music that has been paused

var resumeBackgroundMusic

resume background music that has been paused

local resumeBackgroundMusic

resume background music that has been paused

- (void) resumeEffect: (ALuint)  soundId

resume an audio

- (void) resumeEffect: var  soundId

resume an audio

- (void) resumeEffect: local  soundId

resume an audio

- (void) resumeEffect: (ALuint)  soundId

resume an audio

- (void) resumeEffect: var  soundId

resume an audio

- (void) resumeEffect: local  soundId

resume an audio

- (void) rewindBackgroundMusic

rewind the background music

var rewindBackgroundMusic

rewind the background music

local rewindBackgroundMusic

rewind the background music

- (void) rewindBackgroundMusic

rewind the background music

var rewindBackgroundMusic

rewind the background music

local rewindBackgroundMusic

rewind the background music

+ (SimpleAudioEngine*) sharedEngine

returns the shared instance of the SimpleAudioEngine object

var sharedEngine

returns the shared instance of the SimpleAudioEngine object

local sharedEngine

returns the shared instance of the SimpleAudioEngine object

+ (SimpleAudioEngine*) sharedEngine

returns the shared instance of the SimpleAudioEngine object

var sharedEngine

returns the shared instance of the SimpleAudioEngine object

local 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:
var  filePath

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

- (CDSoundSource
*) soundSourceForFile:
local  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.

- (CDSoundSource
*) soundSourceForFile:
var  filePath

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

- (CDSoundSource
*) soundSourceForFile:
local  filePath

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

- (void) stopAllEffects

stop all audioes

var stopAllEffects

stop all audioes

local stopAllEffects

stop all audioes

- (void) stopAllEffects

stop all audioes

var stopAllEffects

stop all audioes

local stopAllEffects

stop all audioes

- (void) stopBackgroundMusic

stops playing background music

var stopBackgroundMusic

stops playing background music

local stopBackgroundMusic

stops playing background music

- (void) stopBackgroundMusic

stops playing background music

var stopBackgroundMusic

stops playing background music

local 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: var  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: local  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) stopEffect: var  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: local  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: var  filePath

unloads an audio effect from memory

- (void) unloadEffect: local  filePath

unloads an audio effect from memory

- (void) unloadEffect: (NSString *)  filePath

unloads an audio effect from memory

- (void) unloadEffect: var  filePath

unloads an audio effect from memory

- (void) unloadEffect: local  filePath

unloads an audio effect from memory

Member Data Documentation

- (BOOL) enabled_
protected
var enabled_
protected
local enabled_
protected
- (BOOL) mute_
protected
var mute_
protected
local 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

var backgroundMusicVolume
readwriteatomicassign

Background music volume.

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

local 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

var effectsVolume
readwriteatomicassign

Effects volume.

Range is 0.0f to 1.0f

local 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.

var 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.

local 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: