Getting Started with C++ Audio Programming for Game Development
eBook - ePub

Getting Started with C++ Audio Programming for Game Development

  1. 116 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Getting Started with C++ Audio Programming for Game Development

About this book

In Detail

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.

Approach

This book is a standard tutorial targeted at game developers which aims to help them incorporate audio programming techniques to enhance their gameplay experience.

Who this book is for

This book is perfect for C++ game developers who have no experience with audio programming and who would like a quick introduction to the most important topics required to integrate audio into a game.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

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
Cover Image by Suresh Mogre ()

Credits

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

About the Author

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.

About the Reviewers

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.

www.PacktPub.com

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...

Table of contents

  1. Getting Started with C++ Audio Programming for Game Development

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Getting Started with C++ Audio Programming for Game Development by David Gouveia in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.