Getting Started with C++ Audio Programming for Game Development
Table of Contents
Getting Started with C++ Audio Programming for Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Audio Concepts
Sound waves
Analog and digital audio
Multi-channel audio
Audio file formats
Summary
2. Audio Playback
Understanding FMOD
Installing FMOD Ex Programmer's API
Creating and managing the audio system
Loading and streaming audio files
Playing sounds
Checking for errors
Project 1 â building a simple audio manager
Class definition
Initialization and destruction
Loading or streaming sounds
Playing sounds
A note about the code samples
Summary
3. Audio Control
The channel handle
Controlling the playback
Controlling the volume
Controlling the pitch
Controlling the panning
Grouping channels together
Controlling groups of channels
Project 2 â improving the audio manager
Class definition
Initialization and destruction
Loading songs and sound effects
Playing and stopping sound effects
Playing and stopping songs
Controlling the master volume of each category
Summary
4. 3D Audio
Positional audio
Positional audio in FMOD
Creating an audio source
Setting the audio source's position and velocity
Setting the audio source's direction
Setting the audio source's range
Setting the audio listener's properties
Integration with a game
Reverb
Reverb in FMOD
Creating a reverb object
Setting reverb properties
Setting reverb position and radius
Setting the default ambient reverb
Obstruction and occlusion
Obstruction and occlusion in FMOD
Effects
Effects in FMOD
Example 1 â time stretching
Example 2 â simple radio effect
Summary
5. Intelligent Audio
Audio files versus sound events
Introducing the FMOD Designer
Simple events
Examples of simple events
Avoiding repetitive sound effects
Creating a footsteps sound loop
Creating a breaking glass sound effect
Creating an ambient track of singing birds
Multi-track events
Examples of multi-track events
Creating an interactive footsteps sound loop
Simulating the sound of a car engine
Creating a complex ambient track of a forest
Interactive music
The vertical approach (re-orchestration)
The horizontal approach (re-sequencing)
Calling sound events from the game code
Summary
6. Low-level Audio
Representing audio data
Playing audio data
Loading a sound
Playing a sound
Pausing a sound
Looping a sound
Changing volume
Changing pitch
Changing panning
Mixing multiple sounds
Implementing a delay effect
Synthesizing a sound
Summary
Index
Getting Started with C++ Audio Programming for Game Development
Copyright © 2013 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: August, 2013
Production Reference: 1190813
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-84969-909-9
www.packtpub.com
Author
David Gouveia
Reviewers
Tomas Pettersson
Daniel Varela
Acquisition Editor
Edward Gordon
Commissioning Editor
Shreerang Deshpande
Technical Editors
Larissa Pinto
Nitee Shetty
Project Coordinator
Suraj Bist
Proofreader
Lesley Harrison
Indexer
Tejal Soni
Graphics
Abhinash Sahu
Production Coordinator
Melwyn D'sa
Cover Work
Melwyn D'sa
David Gouveia is a Software Engineer and Game Developer from Portugal, Madeira Island. He recently finished his MSc in Computer Science, with a specialization in graphics and multimedia, and is currently working full-time as a game programmer for a local company. He runs an educational blog about game development and enjoys sharing his knowledge with the community whenever possible. His main interests in game development are graphics and audio programming. He also has a strong interest in music and synthesizers, having played the keyboard most of his life.
Tomas Pettersson is a creator of the freeware audio tools SFXR and Musagi.
Daniel Varela was born in Trebujena, Spain, in 1980. His strong passion for music and technology led him to obtain a Bachelor's degree in Sound and Image Engineering from the University of MĂĄlaga, Spain, in 2004.
From very early on in his education, he focused on digital audio signal processing, designing and developing software simulations for audio signals quantification noise modeling, experimental reverb effects, and culminating in an application for the digital audio editing as his final project of studies.
After graduating, he worked for six years in the software consultancy area as an Applications Programmer and Analyst. During this stage, he improved his Object Oriented Programming skills and working methodology, but however, he felt like something was missing.
In 2010, he joined TheGameKitchen, a just born indie videogames development company, as a Generalist Programmer. During this period, he made familiar game engines, such as XNA or Unity3D and developed some audio application prototypes, such as a MOD tracker player for XNA or a scratching application for Windows Phone.
In 2011, he started working at BlitzGamesStudios in the UK as Audio Programmer, developing a successful career in the area of audio programming for videogames. He is responsible for maintaining and improving an existing cross platform end to end audio pipeline, as well as working with third party audio middleware such as FMOD and Wwise.
Support files, eBooks, discount offers and more
You might want to visit www.PacktPub.com for support files and downloads related to your book.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as...