8. Pump Up the Volume!

In the last chapter you learned how to create menus and link scenes together in your games. Now it is time to head back into the gameplay and add music and sound effects to Space Viking. In this chapter you will learn how to use the audio engine included with Cocos2D and how you can add audio to your own games. Read on to hear what Ole the Viking sounds like, and find out what sounds break the silence of the alien planet.

Introducing CocosDenshion

Apple provides two great frameworks to play audio on iOS devices, AVAudioPlayer and OpenAL. AVAudioPlayer is a quick and simple way to play audio but gives you only limited control, while OpenAL is a lower-level API with more features.

Cocos2D comes bundled with the CocosDenshion ...

Get Learning Cocos2D: A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.