14.4 Sound and Music


14.4 Sound and Music

Sound and music are both important aspects of a game. Programmers need to make sure sounds are played at the right time, that music is played in the background, and that sounds are mapped to events within the game. For example, if a character jumps, the correct jump sound should be played and perhaps a thump is played as the character returns to the ground. There are a number of ways programmers can play sounds in a game, but the most common and simplest is to use a middleware library like one of the graphics libraries to draw graphics. Naturally, libraries are not an exclusive choice. Often, developers will use a combination of many libraries together-one library for sound, one for graphics, one for physics, and so on. The following sections summarize some of the available sound libraries.

14.4.1 OpenAL

OpenAL (Open Audio Library) is seen as a companion to OpenGL, in the same way DirectX is a complement of packages for graphics and audio. More than this, however, OpenAL is a complex library of audio technologies delivering some high-quality features free of charge to the developer. OpenAL is used in a wide number of computer games on many platforms since, like OpenGL, OpenAL is cross platform as well as open source. It features a suite of functions that can play sound files in various formats like MP3, OGG, and WAV. Many of these sounds can also be played simultaneously in select channels, and 3D effects can also be added.

Where to get it: http://www.openal.org/

14.4.2 FMOD

FMOD is another popular set of tools for developing audio for computer games, but unlike OpenAL, FMOD is a commercial distribution and there is a license for developers who distribute commercial applications using FMOD. This library has a comprehensive list of platforms upon which it has been distributed, ranging from Windows and GNU/Linux to gaming consoles such as PlayStation and Xbox. One of the attractive features of FMOD is that it is so simple to use. This library is discussed in more detail in Chapter 20.

Where to get it: http://www.fmod.org/

14.4.3 BASS

BASS is a powerful and comparatively cheap audio library that is popular among indie developers, although it runs on fewer supported platforms than FMOD, namely, Windows and Mac OSX only. Like FMOD, BASS is simple to use. This library is considered in more detail in Chapter 20.

Where to get it: http://www.un4seen.com/




Introduction to Game Programming with C++
Introduction to Game Programming with C++ (Wordware Game Developers Library)
ISBN: 1598220322
EAN: 2147483647
Year: 2007
Pages: 225
Authors: Alan Thorn

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net