
196 7. Sound
In the Game class run function, we add a call to Audio class run function (Listing 7.17). In
Game::deleteAll(), we will delete the audio pointer (Listing 7.18).
audio->run(); // Perform periodic sound engine tasks
Listing 7.17. Calling the Audio class run function.
SAFE_DELETE(audio);
Listing 7.18. Deleting the audio pointer.
To make the function call to play a sound a little cleaner, we added an Audio pointer to the
Entity class as well (Listing 7.19). is pointer is initialized in the Entity::initialize
function (Listing 7.20).
Audio *audio; // Pointer to audio system
Listing 7.19. Adding an Audio pointer to the entity.h le.
//======================================================================== ...