cocos2d-x  3.0
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...
 
(void) - stopSound:
 Stops playing a sound. More...
 
(void) - 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:
(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...
 
(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...
 
(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:
(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...
 
(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
sourceGroup_sourceGroups
ALCcontext * context
NSUInteger _sourceGroupTotal
UInt32 _audioSessionCategory
BOOL _handleAudioSession
ALfloat _preMuteGain
NSObject * _mutexBufferLoad
BOOL mute_
BOOL enabled_
ALenum lastErrorCode_
BOOL functioning_
float asynchLoadProgress_
BOOL getGainWorks_
int 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: (CDSoundSource *)  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: (int)  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: (int)  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: (int)  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: (NSArray *)  sourceGroupDefinitions
- (void) defineSourceGroups: (int[])  sourceGroupDefinitions
total: (NSUInteger)  total 
- (void) defineSourceGroups: (int[])  sourceGroupDefinitions
total: (NSUInteger)  total 
- (id) 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.

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

Pause all sounds.

- (void) pauseAllSounds

Pause all sounds.

- (void) pauseSound: (ALuint)  sourceId

Pause a sound.

- (void) pauseSound: (ALuint)  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: (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

- (void) resumeAllSounds

Resume all sounds.

- (void) resumeAllSounds

Resume all sounds.

- (void) resumeSound: (ALuint)  sourceId

Resume a sound.

- (void) resumeSound: (ALuint)  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: (Float32)  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: (int)  sourceGroupId
enabled: (BOOL)  enabled 
- (void)
setSourceGroupNonInterruptible:
(int)  sourceGroupId
isNonInterruptible: (BOOL)  isNonInterruptible 
- (void)
setSourceGroupNonInterruptible:
(int)  sourceGroupId
isNonInterruptible: (BOOL)  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:
(int)  soundId
sourceGroupId: (int)  sourceGroupId 

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

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

Stops all playing sounds.

- (void) stopAllSounds

Stops all playing sounds.

- (void) stopSound: (ALuint)  sourceId

Stops playing a sound.

- (void) stopSound: (ALuint)  sourceId

Stops playing a sound.

- (void) stopSourceGroup: (int)  sourceGroupId

Stops playing a source group.

- (void) stopSourceGroup: (int)  sourceGroupId

Stops playing a source group.

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

Member Data Documentation

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

Property Documentation

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

Total number of source groups that have been defined.

- (int) sourceTotal
readatomicassign

Total number of sources available.


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