Book Image

Building Android Games with Cocos2d-x

By : Raydelto Hernandez
Book Image

Building Android Games with Cocos2d-x

By: Raydelto Hernandez

Overview of this book

Table of Contents (16 chapters)
Building Android Games with Cocos2d-x
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The new audio engine


Cocos2d-x 3.4 in its experimental phase had a new audio engine built from scratch in order to add more functionalities and flexibility. The new audio engine of Cocos2d-x is now available for the Android, iOS, the Mac OS, and the win-32 platforms. It is able to reproduce up to 24 simultaneous sounds on the Android platform; this number may change depending on the platform.

If you run the tests bundled with the Cocos2d-x framework, then you can test both of the audio engines. At runtime, they may sound without any apparent difference but they are internally very different.

Unlike the CocosDenshion engine, there is no distinction between the sound effect and the background music in this new engine. Therefore, the framework has only one setVolume method in contrast to CocosDenshion, which has two methods—setBackgroundMusicVolume and the setEffectsVolume. Later on in this section, we will show you how to adjust the volume of each played audio regardless of whether or not it...