CDSoundEngine Class Reference
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
-
masterGain
property -
lastErrorCode
property -
functioning
property -
asynchLoadProgress
property -
getGainWorks
property -
sourceTotal
Total number of sources available
property -
sourceGroupTotal
Total number of source groups that have been defined
property -
+ setMixerSampleRate:
Sets the sample rate for the audio mixer. For best performance this should match the sample rate of your audio content
-
– init
Initializes the engine with a group definition and a total number of groups
-
– 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
-
– soundSourceForSound:sourceGroupId:
Creates and returns a sound source object for the specified sound within the specified source group.
-
– stopSound:
Stops playing a sound
-
– stopSourceGroup:
Stops playing a source group
-
– stopAllSounds
Stops all playing sounds
-
– defineSourceGroups:
-
– defineSourceGroups:total:
-
– setSourceGroupNonInterruptible:isNonInterruptible:
-
– setSourceGroupEnabled:enabled:
-
– sourceGroupEnabled:
-
– loadBufferFromData:soundData:format:size:freq:
-
– loadBuffer:filePath:
-
– loadBuffersAsynchronously:
-
– unloadBuffer:
-
– openALContext
-
– bufferDurationInSeconds:
Returns the duration of the buffer in seconds or a negative value if the buffer id is invalid
-
– bufferSizeInBytes:
Returns the size of the buffer in bytes or a negative value if the buffer id is invalid
-
– bufferFrequencyInHertz:
Returns the sampling frequency of the buffer in hertz or a negative value if the buffer id is invalid
-
– _soundSourcePreRelease:
Used internally, never call unless you know what you are doing
Other Methods
-
– init:
Initializes the engine with a group definition, a total number of groups and an audio session category
-
– audioSessionInterrupted
-
– audioSessionResumed
Properties
Instance Methods
_soundSourcePreRelease:
Used internally, never call unless you know what you are doing
- (void)_soundSourcePreRelease:(CDSoundSource *)soundSource
Declared In
CocosDenshion.h
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
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
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
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