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

Simple events


Simple events are the easiest to use, as well as the least resource intensive. We should therefore try to use simple events whenever they are enough for our requirements. With a simple event, we can:

  • Create a sound composed by multiple audio files

  • Play audio files sequentially or in a random order

  • Randomize sound properties, such as volume or pitch

  • Control the looping behavior of the sound

  • Play multiple audio files at once, or at certain intervals

To create a simple event, go to the Events section, right-click on top of any Event Group, and then select the Add Simple Event option. If there is no Event Group created, we can create one from the same context menu. Event groups behave like folders and serve to organize all of our events:

With the event selected, the next step is to add the audio files that compose it to the Playlist pane, either through the right-click context menu, or by dragging some audio files into it. If we intend to play the audio files in a random order, we can...