Mario Kart Dev Diary: Sound Manager

Mario Kart Dev Diary: Sound Manager

Mar 19, 2019. | By: Lewis Bond
1 min

Sounds

For sounds I implemented a audio manager using the system locator class Matt implemented. The locator class allowed for anything within there to be called where ever it is needed so it made scene to put a getter to the Audio Manager in there instead of passing down through the scenes or instantiating it all over the place. This time the solution to an issue I had for saw when I took the task of sounds had already been solved.

Audio Manager

The Audio Manager has every sound in the game setup so whenever we need any sound it is just there in one location. For the time being it stores the sounds in different vectors. These are broken down by when the sound is used: menu sounds, game sounds, character sounds, misc sounds.

	std::vector<Sound*> m_menuSounds;
	std::vector<Sound*> m_gameSounds;
	std::vector<Sound*> m_characterSounds;
	std::vector<Sound*> m_miscSounds;

The constants header then stores multiple enums that allow the us to access the files we need. There is an enum for the catergory of sound eg. menu, game etc. There are then an enum for every catergory which stores an enum relating to the sound in the vector. To play any sound for example the countdown, all we need to do now is just…

Locator::getAudio()->Play(SOUND_TYPE::MISC, (int)SOUNDS_MISC::COUNTDOWN);

PREVIOUS BLOG POST NEXT BLOG POST

About

Those who can do and those who can't teach games design.

Our Bunker



United Kingdom.