The sound of music
We now turn to the audio soundtrack for our game. Just like a movie soundtrack, the music that is played during a game sets the tone for the game. Many games have huge, orchestrated productions, while others have synthesized or 8-bit music.
As we have already discussed, music files are handled in a different manner from sound effects. This is because sound effects are usually very short sounds that can be best stored as wav files. Music files tend to be much longer, and are stored as MP3 files because the data can be compressed, taking less storage and less memory.
We are going to add a single music track to our game. To keep things simple, we will tell the track to loop so that it runs continuously throughout the game.
We will start by adding a sound pointer. Open RoboRacer2D.cpp
and add the following line of code to the variable declarations:
FMOD::Sound* musBackground;
Next, go to the LoadAudio
function and add the following line:
result = audiomgr->createSound("resources...