In this project, we will be creating a SimpleAudioManager
class that combines everything that was covered in this chapter. Creating a wrapper for an underlying system that only exposes the operations that we need is known as the
façade design pattern, and is very useful in order to keep things nice and simple.
Since we have not seen how to manipulate sound yet, do not expect this class to be powerful enough to be used in a complex game. Its main purpose will be to let you load and play one-shot sound effects with very little code (which could in fact be enough for very simple games).
It will also free you from the responsibility of dealing with sound objects directly (and having to release them) by allowing you to refer to any loaded sound by its filename. The following is an example of how to use the class:
SimpleAudioManager audio; audio.Load("explosion.wav"); audio.Play("explosion.wav");
From an educational point of view, what is perhaps even more...