cocos2d-x  3.0-beta2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CDSoundEngine Class Reference

#import <CocosDenshion.h>

Inheritance diagram for CDSoundEngine:
<CDAudioInterruptProtocol> <CDAudioInterruptProtocol>

Instance Methods

(id) - init
 Initializes the engine with a group definition and a total number of groups. More...
 
(ALuint) - playSound:sourceGroupId:pitch:pan:gain:loop:
 Plays a sound in a channel group with a pitch, pan and gain. More...
 
(CDSoundSource *) - soundSourceForSound:sourceGroupId:
 Creates and returns a sound source object for the specified sound within the specified source group. More...
 
local - soundSourceForSound:sourceGroupId:
 Creates and returns a sound source object for the specified sound within the specified source group. More...
 
(void) - stopSound:
 Stops playing a sound. More...
 
(void) - stopSourceGroup:
 Stops playing a source group. More...
 
var - stopSourceGroup:
 Stops playing a source group. More...
 
local - stopSourceGroup:
 Stops playing a source group. More...
 
(void) - stopAllSounds
 Stops all playing sounds. More...
 
(void) - pauseSound:
 Pause a sound. More...
 
(void) - pauseAllSounds
 Pause all sounds. More...
 
(void) - resumeSound:
 Resume a sound. More...
 
(void) - resumeAllSounds
 Resume all sounds. More...
 
(void) - defineSourceGroups:
(void) - defineSourceGroups:total:
var - defineSourceGroups:total:
local - defineSourceGroups:total:
(void) - setSourceGroupNonInterruptible:isNonInterruptible:
var - setSourceGroupNonInterruptible:isNonInterruptible:
local - setSourceGroupNonInterruptible:isNonInterruptible:
(void) - setSourceGroupEnabled:enabled:
(BOOL) - sourceGroupEnabled:
(BOOL) - loadBufferFromData:soundData:format:size:freq:
var - loadBufferFromData:soundData:format:size:freq:
local - loadBufferFromData:soundData:format:size:freq:
(BOOL) - loadBuffer:filePath:
(void) - loadBuffersAsynchronously:
(BOOL) - unloadBuffer:
(ALCcontext *) - openALContext
(float) - bufferDurationInSeconds:
 Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid. More...
 
(ALsizei) - bufferSizeInBytes:
 Returns the size of the buffer in bytes or a negative value if the buffer id is invalid. More...
 
local - bufferSizeInBytes:
 Returns the size of the buffer in bytes or a negative value if the buffer id is invalid. More...
 
(ALsizei) - bufferFrequencyInHertz:
 Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid. More...
 
(void) - _soundSourcePreRelease:
 Used internally, never call unless you know what you are doing. More...
 
(id) - init
 Initializes the engine with a group definition and a total number of groups. More...
 
(ALuint) - playSound:sourceGroupId:pitch:pan:gain:loop:
 Plays a sound in a channel group with a pitch, pan and gain. More...
 
(CDSoundSource *) - soundSourceForSound:sourceGroupId:
 Creates and returns a sound source object for the specified sound within the specified source group. More...
 
(void) - stopSound:
 Stops playing a sound. More...
 
(void) - stopSourceGroup:
 Stops playing a source group. More...
 
var - stopSourceGroup:
 Stops playing a source group. More...
 
local - stopSourceGroup:
 Stops playing a source group. More...
 
(void) - stopAllSounds
 Stops all playing sounds. More...
 
(void) - pauseSound:
 Pause a sound. More...
 
(void) - pauseAllSounds
 Pause all sounds. More...
 
(void) - resumeSound:
 Resume a sound. More...
 
(void) - resumeAllSounds
 Resume all sounds. More...
 
(void) - defineSourceGroups:
(void) - defineSourceGroups:total:
(void) - setSourceGroupNonInterruptible:isNonInterruptible:
(void) - setSourceGroupEnabled:enabled:
(BOOL) - sourceGroupEnabled:
(BOOL) - loadBufferFromData:soundData:format:size:freq:
var - loadBufferFromData:soundData:format:size:freq:
local - loadBufferFromData:soundData:format:size:freq:
(BOOL) - loadBuffer:filePath:
(void) - loadBuffersAsynchronously:
(BOOL) - unloadBuffer:
(ALCcontext *) - openALContext
(float) - bufferDurationInSeconds:
 Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid. More...
 
(ALsizei) - bufferSizeInBytes:
 Returns the size of the buffer in bytes or a negative value if the buffer id is invalid. More...
 
(ALsizei) - bufferFrequencyInHertz:
 Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid. More...
 
(void) - _soundSourcePreRelease:
 Used internally, never call unless you know what you are doing. 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...
 
local - 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

(void) + setMixerSampleRate:
 Sets the sample rate for the audio mixer. More...
 
(void) + setMixerSampleRate:
 Sets the sample rate for the audio mixer. More...
 

Protected Attributes

bufferInfo_buffers
sourceInfo_sources
var _sources
local _sources
sourceGroup_sourceGroups
var _sourceGroups
local _sourceGroups
ALCcontext * context
var context
local context
NSUInteger _sourceGroupTotal
var _sourceGroupTotal
local _sourceGroupTotal
UInt32 _audioSessionCategory
var _audioSessionCategory
local _audioSessionCategory
BOOL _handleAudioSession
var _handleAudioSession
local _handleAudioSession
ALfloat _preMuteGain
NSObject * _mutexBufferLoad
var _mutexBufferLoad
local _mutexBufferLoad
BOOL mute_
BOOL enabled_
ALenum lastErrorCode_
var lastErrorCode_
local lastErrorCode_
BOOL functioning_
var functioning_
local functioning_
float asynchLoadProgress_
var asynchLoadProgress_
local asynchLoadProgress_
BOOL getGainWorks_
int sourceTotal_
var sourceTotal_
local sourceTotal_
int bufferTotal

Properties

ALfloat masterGain
ALenum lastErrorCode
BOOL functioning
float asynchLoadProgress
BOOL getGainWorks
int sourceTotal
 Total number of sources available. More...
 
NSUInteger sourceGroupTotal
 Total number of source groups that have been defined. More...
 

Method Documentation

- (void) _soundSourcePreRelease: (CDSoundSource *)  soundSource

Used internally, never call unless you know what you are doing.

- (void) _soundSourcePreRelease: var  soundSource

Used internally, never call unless you know what you are doing.

- (void) _soundSourcePreRelease: local  soundSource

Used internally, never call unless you know what you are doing.

- (void) _soundSourcePreRelease: (CDSoundSource *)  soundSource

Used internally, never call unless you know what you are doing.

- (void) _soundSourcePreRelease: var  soundSource

Used internally, never call unless you know what you are doing.

- (void) _soundSourcePreRelease: local  soundSource

Used internally, never call unless you know what you are doing.

- (float) bufferDurationInSeconds: (int)  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (float) bufferDurationInSeconds: var  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (float) bufferDurationInSeconds: local  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (float) bufferDurationInSeconds: (int)  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (float) bufferDurationInSeconds: var  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (float) bufferDurationInSeconds: local  soundId

Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: (int)  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: var  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: local  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: (int)  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: var  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferFrequencyInHertz: local  soundId

Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: (int)  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: var  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: local  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: (int)  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: var  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (ALsizei) bufferSizeInBytes: local  soundId

Returns the size of the buffer in bytes or a negative value if the buffer id is invalid.

- (void) defineSourceGroups: (NSArray *)  sourceGroupDefinitions
- (void) defineSourceGroups: var  sourceGroupDefinitions
- (void) defineSourceGroups: local  sourceGroupDefinitions
- (void) defineSourceGroups: (NSArray *)  sourceGroupDefinitions
- (void) defineSourceGroups: var  sourceGroupDefinitions
- (void) defineSourceGroups: local  sourceGroupDefinitions
- (void) defineSourceGroups: (int[])  sourceGroupDefinitions
total: (NSUInteger)  total 
- (void) defineSourceGroups: var  sourceGroupDefinitions
total: var  total 
- (void) defineSourceGroups: local  sourceGroupDefinitions
total: local  total 
- (void) defineSourceGroups: (int[])  sourceGroupDefinitions
total: (NSUInteger)  total 
- (void) defineSourceGroups: var  sourceGroupDefinitions
total: var  total 
- (void) defineSourceGroups: local  sourceGroupDefinitions
total: local  total 
- (id) init

Initializes the engine with a group definition and a total number of groups.

var init

Initializes the engine with a group definition and a total number of groups.

local init

Initializes the engine with a group definition and a total number of groups.

- (id) init

Initializes the engine with a group definition and a total number of groups.

var init

Initializes the engine with a group definition and a total number of groups.

local init

Initializes the engine with a group definition and a total number of groups.

- (BOOL) loadBuffer: (int)  soundId
filePath: (NSString *)  filePath 
- (BOOL) loadBuffer: var  soundId
filePath: var  filePath 
- (BOOL) loadBuffer: local  soundId
filePath: local  filePath 
- (BOOL) loadBuffer: (int)  soundId
filePath: (NSString *)  filePath 
- (BOOL) loadBuffer: var  soundId
filePath: var  filePath 
- (BOOL) loadBuffer: local  soundId
filePath: local  filePath 
- (BOOL) loadBufferFromData: (int)  soundId
soundData: (ALvoid *)  soundData
format: (ALenum)  format
size: (ALsizei)  size
freq: (ALsizei)  freq 
- (BOOL) loadBufferFromData: var  soundId
soundData: var  soundData
format: var  format
size: var  size
freq: var  freq 
- (BOOL) loadBufferFromData: local  soundId
soundData: local  soundData
format: local  format
size: local  size
freq: local  freq 
- (BOOL) loadBufferFromData: (int)  soundId
soundData: (ALvoid *)  soundData
format: (ALenum)  format
size: (ALsizei)  size
freq: (ALsizei)  freq 
- (BOOL) loadBufferFromData: var  soundId
soundData: var  soundData
format: var  format
size: var  size
freq: var  freq 
- (BOOL) loadBufferFromData: local  soundId
soundData: local  soundData
format: local  format
size: local  size
freq: local  freq 
- (void) loadBuffersAsynchronously: (NSArray *)  loadRequests
- (void) loadBuffersAsynchronously: var  loadRequests
- (void) loadBuffersAsynchronously: local  loadRequests
- (void) loadBuffersAsynchronously: (NSArray *)  loadRequests
- (void) loadBuffersAsynchronously: var  loadRequests
- (void) loadBuffersAsynchronously: local  loadRequests
- (ALCcontext *) openALContext
var openALContext
local openALContext
- (ALCcontext *) openALContext
var openALContext
local openALContext
- (void) pauseAllSounds

Pause all sounds.

var pauseAllSounds

Pause all sounds.

local pauseAllSounds

Pause all sounds.

- (void) pauseAllSounds

Pause all sounds.

var pauseAllSounds

Pause all sounds.

local pauseAllSounds

Pause all sounds.

- (void) pauseSound: (ALuint)  sourceId

Pause a sound.

- (void) pauseSound: var  sourceId

Pause a sound.

- (void) pauseSound: local  sourceId

Pause a sound.

- (void) pauseSound: (ALuint)  sourceId

Pause a sound.

- (void) pauseSound: var  sourceId

Pause a sound.

- (void) pauseSound: local  sourceId

Pause a sound.

- (ALuint) playSound: (int)  soundId
sourceGroupId: (int)  sourceGroupId
pitch: (float)  pitch
pan: (float)  pan
gain: (float)  gain
loop: (BOOL)  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (ALuint) playSound: var  soundId
sourceGroupId: var  sourceGroupId
pitch: var  pitch
pan: var  pan
gain: var  gain
loop: var  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (ALuint) playSound: local  soundId
sourceGroupId: local  sourceGroupId
pitch: local  pitch
pan: local  pan
gain: local  gain
loop: local  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (ALuint) playSound: (int)  soundId
sourceGroupId: (int)  sourceGroupId
pitch: (float)  pitch
pan: (float)  pan
gain: (float)  gain
loop: (BOOL)  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (ALuint) playSound: var  soundId
sourceGroupId: var  sourceGroupId
pitch: var  pitch
pan: var  pan
gain: var  gain
loop: var  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (ALuint) playSound: local  soundId
sourceGroupId: local  sourceGroupId
pitch: local  pitch
pan: local  pan
gain: local  gain
loop: local  loop 

Plays a sound in a channel group with a pitch, pan and gain.

The sound could played looped or not

- (void) resumeAllSounds

Resume all sounds.

var resumeAllSounds

Resume all sounds.

local resumeAllSounds

Resume all sounds.

- (void) resumeAllSounds

Resume all sounds.

var resumeAllSounds

Resume all sounds.

local resumeAllSounds

Resume all sounds.

- (void) resumeSound: (ALuint)  sourceId

Resume a sound.

- (void) resumeSound: var  sourceId

Resume a sound.

- (void) resumeSound: local  sourceId

Resume a sound.

- (void) resumeSound: (ALuint)  sourceId

Resume a sound.

- (void) resumeSound: var  sourceId

Resume a sound.

- (void) resumeSound: local  sourceId

Resume a sound.

+ (void) setMixerSampleRate: (Float32)  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

+ (void) setMixerSampleRate: var  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

+ (void) setMixerSampleRate: local  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

+ (void) setMixerSampleRate: (Float32)  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

+ (void) setMixerSampleRate: var  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

+ (void) setMixerSampleRate: local  sampleRate

Sets the sample rate for the audio mixer.

For best performance this should match the sample rate of your audio content

- (void) setSourceGroupEnabled: (int)  sourceGroupId
enabled: (BOOL)  enabled 
- (void) setSourceGroupEnabled: var  sourceGroupId
enabled: var  enabled 
- (void) setSourceGroupEnabled: local  sourceGroupId
enabled: local  enabled 
- (void) setSourceGroupEnabled: (int)  sourceGroupId
enabled: (BOOL)  enabled 
- (void) setSourceGroupEnabled: var  sourceGroupId
enabled: var  enabled 
- (void) setSourceGroupEnabled: local  sourceGroupId
enabled: local  enabled 
- (void)
setSourceGroupNonInterruptible:
(int)  sourceGroupId
isNonInterruptible: (BOOL)  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
var  sourceGroupId
isNonInterruptible: var  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
local  sourceGroupId
isNonInterruptible: local  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
(int)  sourceGroupId
isNonInterruptible: (BOOL)  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
var  sourceGroupId
isNonInterruptible: var  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
local  sourceGroupId
isNonInterruptible: local  isNonInterruptible 
- (CDSoundSource
*) soundSourceForSound:
(int)  soundId
sourceGroupId: (int)  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (CDSoundSource
*) soundSourceForSound:
var  soundId
sourceGroupId: var  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (CDSoundSource
*) soundSourceForSound:
local  soundId
sourceGroupId: local  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (CDSoundSource
*) soundSourceForSound:
(int)  soundId
sourceGroupId: (int)  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (CDSoundSource
*) soundSourceForSound:
var  soundId
sourceGroupId: var  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (CDSoundSource
*) soundSourceForSound:
local  soundId
sourceGroupId: local  sourceGroupId 

Creates and returns a sound source object for the specified sound within the specified source group.

- (BOOL) sourceGroupEnabled: (int)  sourceGroupId
- (BOOL) sourceGroupEnabled: var  sourceGroupId
- (BOOL) sourceGroupEnabled: local  sourceGroupId
- (BOOL) sourceGroupEnabled: (int)  sourceGroupId
- (BOOL) sourceGroupEnabled: var  sourceGroupId
- (BOOL) sourceGroupEnabled: local  sourceGroupId
- (void) stopAllSounds

Stops all playing sounds.

var stopAllSounds

Stops all playing sounds.

local stopAllSounds

Stops all playing sounds.

- (void) stopAllSounds

Stops all playing sounds.

var stopAllSounds

Stops all playing sounds.

local stopAllSounds

Stops all playing sounds.

- (void) stopSound: (ALuint)  sourceId

Stops playing a sound.

- (void) stopSound: var  sourceId

Stops playing a sound.

- (void) stopSound: local  sourceId

Stops playing a sound.

- (void) stopSound: (ALuint)  sourceId

Stops playing a sound.

- (void) stopSound: var  sourceId

Stops playing a sound.

- (void) stopSound: local  sourceId

Stops playing a sound.

- (void) stopSourceGroup: (int)  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: var  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: local  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: (int)  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: var  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: local  sourceGroupId

Stops playing a source group.

- (BOOL) unloadBuffer: (int)  soundId
- (BOOL) unloadBuffer: var  soundId
- (BOOL) unloadBuffer: local  soundId
- (BOOL) unloadBuffer: (int)  soundId
- (BOOL) unloadBuffer: var  soundId
- (BOOL) unloadBuffer: local  soundId

Member Data Documentation

- (UInt32) _audioSessionCategory
protected
var _audioSessionCategory
protected
local _audioSessionCategory
protected
- (bufferInfo *) _buffers
protected
var _buffers
protected
local _buffers
protected
- (BOOL) _handleAudioSession
protected
var _handleAudioSession
protected
local _handleAudioSession
protected
- (NSObject *) _mutexBufferLoad
protected
var _mutexBufferLoad
protected
local _mutexBufferLoad
protected
- (ALfloat) _preMuteGain
protected
var _preMuteGain
protected
local _preMuteGain
protected
- (sourceGroup *) _sourceGroups
protected
var _sourceGroups
protected
local _sourceGroups
protected
- (NSUInteger) _sourceGroupTotal
protected
var _sourceGroupTotal
protected
local _sourceGroupTotal
protected
- (sourceInfo *) _sources
protected
var _sources
protected
local _sources
protected
- (float) asynchLoadProgress_
protected
var asynchLoadProgress_
protected
local asynchLoadProgress_
protected
- (int) bufferTotal
protected
var bufferTotal
protected
local bufferTotal
protected
- (ALCcontext *) context
protected
var context
protected
local context
protected
- (BOOL) enabled_
protected
var enabled_
protected
local enabled_
protected
- (BOOL) functioning_
protected
var functioning_
protected
local functioning_
protected
- (BOOL) getGainWorks_
protected
var getGainWorks_
protected
local getGainWorks_
protected
- (ALenum) lastErrorCode_
protected
var lastErrorCode_
protected
local lastErrorCode_
protected
- (BOOL) mute_
protected
var mute_
protected
local mute_
protected
- (int) sourceTotal_
protected
var sourceTotal_
protected
local sourceTotal_
protected

Property Documentation

- (float) asynchLoadProgress
readwriteatomicassign
var asynchLoadProgress
readwriteatomicassign
local asynchLoadProgress
readwriteatomicassign
- (BOOL) functioning
readatomicassign
var functioning
readatomicassign
local functioning
readatomicassign
- (BOOL) getGainWorks
readatomicassign
var getGainWorks
readatomicassign
local getGainWorks
readatomicassign
- (ALenum) lastErrorCode
readatomicassign
var lastErrorCode
readatomicassign
local lastErrorCode
readatomicassign
- (ALfloat) masterGain
readwritenonatomicassign
var masterGain
readwritenonatomicassign
local masterGain
readwritenonatomicassign
- (NSUInteger) sourceGroupTotal
readatomicassign

Total number of source groups that have been defined.

var sourceGroupTotal
readatomicassign

Total number of source groups that have been defined.

local sourceGroupTotal
readatomicassign

Total number of source groups that have been defined.

- (int) sourceTotal
readatomicassign

Total number of sources available.

var sourceTotal
readatomicassign

Total number of sources available.

local sourceTotal
readatomicassign

Total number of sources available.


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