Inherits from NSObject
Conforms to CDAudioInterruptProtocol
Declared in CocosDenshion.h

Overview

CDSoundEngine is built upon OpenAL and works with SDK 2.0. CDSoundEngine is a sound engine built upon OpenAL and derived from Apple’s oalTouch example. It can playback up to 32 sounds simultaneously with control over pitch, pan and gain. It can be set up to handle audio session interruption automatically. You may decide to use CDSoundEngine directly instead of CDAudioManager or SimpleAudioEngine because you require OS 2.0 compatibility.

Requirements: – Firmware: OS 2.0 or greater – Files: CocosDenshion.* – Frameworks: OpenAL, AudioToolbox

Tasks

Other Methods

Other Methods

Properties

asynchLoadProgress

functioning

getGainWorks

lastErrorCode

masterGain

sourceGroupTotal

Total number of source groups that have been defined

@property (readonly) NSUInteger sourceGroupTotal

Declared In

CocosDenshion.h

sourceTotal

Total number of sources available

@property (readonly) int sourceTotal

Declared In

CocosDenshion.h

Class Methods

setMixerSampleRate:

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

Declared In

CocosDenshion.h

Instance Methods

_soundSourcePreRelease:

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

- (void)_soundSourcePreRelease:(CDSoundSource *)soundSource

Declared In

CocosDenshion.h

audioSessionInterrupted

audioSessionResumed

bufferDurationInSeconds:

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

- (float)bufferDurationInSeconds:(int)soundId

Declared In

CocosDenshion.h

bufferFrequencyInHertz:

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

- (ALsizei)bufferFrequencyInHertz:(int)soundId

Declared In

CocosDenshion.h

bufferSizeInBytes:

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

- (ALsizei)bufferSizeInBytes:(int)soundId

Declared In

CocosDenshion.h

defineSourceGroups:

defineSourceGroups:total:

init

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

- (id)init

Declared In

CocosDenshion.h

init:

Initializes the engine with a group definition, a total number of groups and an audio session category

- (id)init:(UInt32)audioSessionCategory

Declared In

CocosDenshion.h

loadBuffer:filePath:

loadBufferFromData:soundData:format:size:freq:

loadBuffersAsynchronously:

openALContext

playSound:sourceGroupId:pitch:pan:gain: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

Declared In

CocosDenshion.h

setSourceGroupEnabled:enabled:

setSourceGroupNonInterruptible:isNonInterruptible:

soundSourceForSound:sourceGroupId:

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

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

Declared In

CocosDenshion.h

sourceGroupEnabled:

stopAllSounds

Stops all playing sounds

- (void)stopAllSounds

Declared In

CocosDenshion.h

stopSound:

Stops playing a sound

- (void)stopSound:(ALuint)sourceId

Declared In

CocosDenshion.h

stopSourceGroup:

Stops playing a source group

- (void)stopSourceGroup:(int)sourceGroupId

Declared In

CocosDenshion.h

unloadBuffer: