cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CocosDenshion.h File Reference

IMPORTANT There are 3 different ways of using CocosDenshion. More...

#import <OpenAL/al.h>
#import <OpenAL/alc.h>
#import <AudioToolbox/AudioToolbox.h>
#import <Foundation/Foundation.h>
#import "CDConfig.h"
#import "CDOpenALSupport.h"

Classes

struct  sourceGroup
 
struct  bufferInfo
 
struct  sourceInfo
 
protocol  <CDAudioTransportProtocol>
 
protocol  <CDAudioInterruptProtocol>
 
class  CDUtilities
 Collection of utilities required by CocosDenshion. More...
 
class  CDSoundEngine
 
class  CDSoundSource
 CDSoundSource is a wrapper around an OpenAL sound source. More...
 
class  CDAudioInterruptTargetGroup
 Container for objects that implement audio interrupt protocol i.e. More...
 
class  CDAsynchBufferLoader
 CDAsynchBufferLoader TODO. More...
 
class  CDBufferLoadRequest
 CDBufferLoadRequest. More...
 
class  CDFloatInterpolator
 
class  CDPropertyModifier
 Base class for classes that modify properties such as pitch, pan and gain. More...
 
class  CDSoundSourceFader
 Fader for CDSoundSource objects. More...
 
class  CDSoundSourcePanner
 Panner for CDSoundSource objects. More...
 
class  CDSoundSourcePitchBender
 Pitch bender for CDSoundSource objects. More...
 
class  CDSoundEngineFader
 Fader for CDSoundEngine objects. More...
 

Macros

#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, CD_BS_EMPTY = 0,
  CD_BS_LOADED = 1, CD_BS_FAILED = 2
}
 
enum  tCDInterpolationType {
  kIT_Linear, kIT_SCurve, kIT_Exponential, kIT_Linear,
  kIT_SCurve, kIT_Exponential
}
 Interpolation type. More...
 

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:

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:

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

Macro Definition Documentation

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

Enumeration Type Documentation

Enumerator
CD_BS_EMPTY 
CD_BS_LOADED 
CD_BS_FAILED 
CD_BS_EMPTY 
CD_BS_LOADED 
CD_BS_FAILED 

Interpolation type.

Enumerator
kIT_Linear 
kIT_SCurve 

Straight linear interpolation fade.

kIT_Exponential 

S curved interpolation.

Exponential interpolation

kIT_Linear 
kIT_SCurve 

Straight linear interpolation fade.

kIT_Exponential 

S curved interpolation.

Exponential interpolation

Variable Documentation

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