CocosDenshion iOS  1.0.1
CocosDenshion API Reference (iOS version) for Kobold2D developers
CocosDenshion.h File Reference
#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Foundation/Foundation.h>
#import "CDConfig.h"
#import "CDOpenALSupport.h"
Include dependency graph for CocosDenshion.h:

Classes

struct  sourceGroup
struct  bufferInfo
struct  sourceInfo
protocol  <CDAudioTransportProtocol>
protocol  <CDAudioInterruptProtocol>
interface  CDUtilities
interface  CDSoundEngine
interface  CDSoundSource
interface  CDAudioInterruptTargetGroup
interface  CDAsynchBufferLoader
interface  CDBufferLoadRequest
interface  CDFloatInterpolator
interface  CDPropertyModifier
interface  CDSoundSourceFader
interface  CDSoundSourcePanner
interface  CDSoundSourcePitchBender
interface  CDSoundEngineFader

Defines

#define CDLOG(...)   do {} while (0)
#define CDLOGINFO(...)   do {} while (0)
#define CD_SOURCE_LIMIT   32
#define CD_NO_SOURCE   0xFEEDFAC
#define CD_IGNORE_AUDIO_SESSION   0xBEEFBEE
#define CD_MUTE   0xFEEDBAB
#define CD_NO_SOUND   = -1;
#define CD_SAMPLE_RATE_HIGH   44100
#define CD_SAMPLE_RATE_MID   22050
#define CD_SAMPLE_RATE_LOW   16000
#define CD_SAMPLE_RATE_BASIC   8000
#define CD_SAMPLE_RATE_DEFAULT   44100

Enumerations

enum  bufferState { CD_BS_EMPTY = 0, CD_BS_LOADED = 1, CD_BS_FAILED = 2 }
enum  tCDInterpolationType { kIT_Linear, kIT_SCurve, kIT_Exponential }

Variables

NSString *const kCDN_BadAlContext
NSString *const kCDN_AsynchLoadComplete
float const kCD_PitchDefault
float const kCD_PitchLowerOneOctave
float const kCD_PitchHigherOneOctave
float const kCD_PanDefault
float const kCD_PanFullLeft
float const kCD_PanFullRight
float const kCD_GainDefault

Detailed Description

IMPORTANT There are 3 different ways of using CocosDenshion. Depending on which you choose you will need to include different files and frameworks.

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

  • Firmware: OS 2.2 or greater
  • Files: SimpleAudioEngine.*, CocosDenshion.*
  • Frameworks: OpenAL, AudioToolbox, AVFoundation
CDAudioManager
CDAudioManager is basically a thin wrapper around an AVAudioPlayer object used for playing background music and a CDSoundEngine object used for playing sound effects. It manages the audio session for you deals with audio session interruption. It is fairly low level and it is expected you have some understanding of the underlying technologies. For example, for many use cases regarding background music it is expected you will work directly with the backgroundMusic AVAudioPlayer which is exposed as a property.

Requirements:

  • Firmware: OS 2.2 or greater
  • Files: CDAudioManager.*, CocosDenshion.*
  • Frameworks: OpenAL, AudioToolbox, AVFoundation
CDSoundEngine
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

Enumeration Type Documentation

Interpolation type

Enumerator:
kIT_SCurve 

Straight linear interpolation fade.

kIT_Exponential 

S curved interpolation.

Exponential interpolation