Book Image

Getting Started with C++ Audio Programming for Game Development

By : David da L Gouveia
Book Image

Getting Started with C++ Audio Programming for Game Development

By: David da L Gouveia

Overview of this book

Audio plays a fundamental role in video games. From music to sound effects or dialogue, it helps to reinforce the experience, convey the mood, and give feedback to the player. Presently, many games have achieved commercial success by incorporating game sounds that have enhanced the user experience. You can achieve this in your games with the help of the FMOD library. This book provides you with a practical guide to implementing the FMOD toolkit in your games. Getting Started with C++ Audio Programming for Game Developers is a quick and practical introduction to the most important audio programming topics that any game developer is expected to know. Whether you need to play only a few audio files or you intend to design a complex audio simulation, this book will help you get started enhancing your game with audio programs. Getting Started with C++ Audio Programming for Game Developers covers a broad range of topics – from loading and playing audio files to simulating sounds within a virtual environment and implementing interactive sounds that react to events in the game. The book starts off with an explanation of the fundamental audio concepts, after which it proceeds to explain how to use the FMOD Ex library, how to implement a 3D audio simulation, how to use the FMOD Designer toolkit, and how best to work with multi-layered sounds with complex behaviors attached to them. The final part of the book deals with working with audio at a much lower level by manipulating audio data directly. This book will provide you with a good foundation so that you can successfully implement audio into your games and begin pursuing other advanced topics in audio programming with confidence.
Table of Contents (13 chapters)
Getting Started with C++ Audio Programming for Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Controlling groups of channels


Most operations supported by channel groups are the same that we have seen already for individual channels. In particular, we can stop, pause, or mute all channels in a group, and control their volume and pitch. The syntax for these operations is the same as before, except for pitch, which is done through a setPitch() method, that instead of a frequency, takes any value between 0 and 10, and multiplies it by the current frequency.

// Calls stop on all channels in the group
channelGroup->stop();
// Mute or pause all channels
channelGroup->setMute(true);
channelGroup->setPaused(true);
// Halve the volume of all sounds in the group
channelGroup->setVolume(0.5f);
// Double the frequency of all sounds in the group
channelGroup->setPitch(2.0f);

All of these changes propagate down the channel group hierarchy automatically, without overwriting the values stored inside the channels. The way these values are applied depends on the type of operation.

For operations...