Book Image

Learning iPhone Game Development with Cocos2D 3.0

By : Kirill Muzykov
Book Image

Learning iPhone Game Development with Cocos2D 3.0

By: Kirill Muzykov

Overview of this book

Table of Contents (19 chapters)
Learning iPhone Game Development with Cocos2D 3.0
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating AudioManager and playing sound effects


You can play sound effects and music on iOS without using any game engine in many different ways, but as I have mentioned before, one of the goals of the game engine such as Cocos2D is to make our lives easier.

This is why Cocos2D uses a great library called ObjectAL that provides a nice interface to the underlying OpenAL framework. A good thing about using ObjectAL is that it provides different levels of control.

For example, there is a class called OALSimpleAudio, which provides a very simple interface to play audio and requires absolutely no knowledge of how things work internally. This class is suitable for most games and provides all the required features to play background and foreground audio files.

On the other hand, you can always go deeper and use some lower-level class that will be more complex, but will also give you more control.

We will start with the basic OALSimpleAudio functionality and will build on top of it along the way.