Chapter 6. Audio
The Cocos2d-x framework comes with an audio engine called CocosDenshion
, which has been inherited from Cocos2d for iPhone. This engine encapsulates all the complexity of playing sound effects and background music. Now, Cocos2d-x has another audio engine that was built from scratch with the aim of providing more flexibility than the CocosDenshion
library. Be aware that there is no plan to eliminate the CocosDenshion
audio engine from the Cocos2d-x framework, it is now common in Cocos2d-x to have redundant components so that programmers can pick whatever fits their needs better.
The following topics will be covered within this chapter:
- Playing background music and sound effects
- Modifying the audio properties
- Handling audio when leaving the game
- The new audio engine