AudioManager: don't initialize when unnecessary

If navigation sounds are disabled, don't initialize AudioManager
unnecessarily.
This commit is contained in:
Conn O'Griofa 2017-09-14 07:20:46 +01:00
parent 35abc91d30
commit 98c170f829

View file

@ -1,4 +1,5 @@
#include "AudioManager.h"
#include "Settings.h"
#include <SDL.h>
#include "Log.h"
@ -62,7 +63,7 @@ AudioManager::~AudioManager()
std::shared_ptr<AudioManager> & AudioManager::getInstance()
{
//check if an AudioManager instance is already created, if not create one
if (sInstance == nullptr) {
if (sInstance == nullptr && Settings::getInstance()->getBool("EnableSounds")) {
sInstance = std::shared_ptr<AudioManager>(new AudioManager);
}
return sInstance;