1 min
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.
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);
Subscribe to this blog via RSS.
Low level programming dev diary 28
Text based adventure dev diary 6
Level design developer diary 3
Game engine programming dev diary 14
Audio-visual production dev diary 7
Audio-Visual Production: Particle System Mesh Spawning Issues
Posted on 20 Feb 2020Low level programming dev diary (28) Text based adventure dev diary (6) Level design developer diary (3) Post mortem (4) Ex-machina dev diary (11) Game engine programming dev diary (14) Network game dev diary (11) Audio-visual production dev diary (7)