Chapter 9

Making Noise with iOS Audio APIs

What You Will Learn In This Chapter:

  • The important role of sound in your games
  • How to play simple sounds with the System Sound Service
  • How to develop more complex sound systems with AV Foundation
  • How to use the MediaPlayer framework to play iPod music in your game

Your exploration of the basic building blocks that you can use to build games for iOS is almost complete. You have covered drawing graphics and displaying sprites, responding to user input for game control, and animation for enhancing visual impact. The last piece of the puzzle is sound.

Sound plays an important role in game design. You can create vastly different moods for your game by your choice of background music. Conversely, you could allow the player to play songs from his own iPod library during gameplay.

Sound effects also play a large part in game design. You can create atmosphere with sound effects as well as provide important audible feedback to the player. If you have ever played a first person shooter, you know how important it can be to hear the footsteps of another player creeping around a corner.

In this chapter, you will learn how to incorporate sounds into your games. You will explore the AV Foundation framework, which provides an Objective-C interface for playing audio. You will also examine the Media Player framework, which you can use to play music from the iPod library.

Playing Simple Sounds with the System Sound Services

The easiest but least flexible ...

Get Beginning iOS Game Development now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.