You are previewing Getting Started with C++ Audio Programming for Game Development.
O'Reilly logo
Getting Started with C++ Audio Programming for Game Development

Book Description

Written specifically to help C++ developers add audio to their games from scratch, this book gives a clear introduction to the concepts and practical application of audio programming using the FMOD library and toolkit.

  • Add audio to your game using FMOD and wrap it in your own code

  • Understand the core concepts of audio programming and work with audio at different levels of abstraction

  • Work with a technology that is widely considered to be the industry standard in audio middleware

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

    Table of Contents

    1. Getting Started with C++ Audio Programming for Game Development
      1. Table of Contents
      2. Getting Started with C++ Audio Programming for Game Development
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Audio Concepts
        1. Sound waves
        2. Analog and digital audio
        3. Multi-channel audio
        4. Audio file formats
        5. Summary
      9. 2. Audio Playback
        1. Understanding FMOD
        2. Installing FMOD Ex Programmer's API
        3. Creating and managing the audio system
        4. Loading and streaming audio files
        5. Playing sounds
        6. Checking for errors
        7. Project 1 – building a simple audio manager
          1. Class definition
          2. Initialization and destruction
          3. Loading or streaming sounds
          4. Playing sounds
          5. A note about the code samples
        8. Summary
      10. 3. Audio Control
        1. The channel handle
        2. Controlling the playback
        3. Controlling the volume
        4. Controlling the pitch
        5. Controlling the panning
        6. Grouping channels together
        7. Controlling groups of channels
        8. Project 2 – improving the audio manager
          1. Class definition
          2. Initialization and destruction
          3. Loading songs and sound effects
          4. Playing and stopping sound effects
          5. Playing and stopping songs
          6. Controlling the master volume of each category
        9. Summary
      11. 4. 3D Audio
        1. Positional audio
        2. Positional audio in FMOD
          1. Creating an audio source
          2. Setting the audio source's position and velocity
          3. Setting the audio source's direction
          4. Setting the audio source's range
          5. Setting the audio listener's properties
          6. Integration with a game
        3. Reverb
        4. Reverb in FMOD
          1. Creating a reverb object
          2. Setting reverb properties
          3. Setting reverb position and radius
          4. Setting the default ambient reverb
        5. Obstruction and occlusion
          1. Obstruction and occlusion in FMOD
        6. Effects
          1. Effects in FMOD
          2. Example 1 – time stretching
          3. Example 2 – simple radio effect
        7. Summary
      12. 5. Intelligent Audio
        1. Audio files versus sound events
        2. Introducing the FMOD Designer
        3. Simple events
          1. Examples of simple events
            1. Avoiding repetitive sound effects
            2. Creating a footsteps sound loop
            3. Creating a breaking glass sound effect
            4. Creating an ambient track of singing birds
        4. Multi-track events
          1. Examples of multi-track events
            1. Creating an interactive footsteps sound loop
            2. Simulating the sound of a car engine
            3. Creating a complex ambient track of a forest
        5. Interactive music
          1. The vertical approach (re-orchestration)
          2. The horizontal approach (re-sequencing)
        6. Calling sound events from the game code
        7. Summary
      13. 6. Low-level Audio
        1. Representing audio data
        2. Playing audio data
        3. Loading a sound
        4. Playing a sound
        5. Pausing a sound
        6. Looping a sound
        7. Changing volume
        8. Changing pitch
        9. Changing panning
        10. Mixing multiple sounds
        11. Implementing a delay effect
        12. Synthesizing a sound
        13. Summary
      14. Index