Paras Mendiratta wrote:
Your solution seems nice especially when we need to continue the same BGM. Just a thought, the method can be integrated within simple audio engine rather than creating soundManager class. Is it something extra doing apart from this?
I noticed on the SimpleAudioEngine class when you play a BGM, the music gets repeated on the very beginning. For example, you have the Main Menu and a Shop Menu. Both of them uses the same BGMs, however, simply using SimpleAudioEngine would reset the currently playing BGM back to the beginning. I don’t want that, so I made the SoundManager class to check if the same BGM is going to be played again so it does not reset back, creating a nice audio loop. It also checks first if the game is muted or not and will only play if it is not muted.
It also contains stuff like SoundManager::playKaching* and similar stuff so that I won’t have to type the file name over and over again when I want to play sounds. It also has a method likeSoundManager::changeVolume( Volume pVolume )* because my project requires 3 volume levels (LOW, MED, HIGH) and not float values. It also hold boolean values to determine if the game is muted or not.
It’s actually just something I made to make my life easier, I just wanted to share it, just in case it becomes helpful.