AudioCommon: Remove checks against NullSound::isValid()

The NullAudio backend is guaranteed to be compiled in, so no reason
to check it.
In addition to that, if it wasn't valid, it wouldn't work as a fallback
in InitSoundStream as there are uses to g_sound_stream later.
This commit is contained in:
Florent Castelli 2017-02-05 00:57:42 +01:00
parent ee8a21f1d0
commit 31dfaafe0b
1 changed files with 3 additions and 4 deletions

View File

@ -33,7 +33,7 @@ void InitSoundStream()
std::string backend = SConfig::GetInstance().sBackend; std::string backend = SConfig::GetInstance().sBackend;
if (backend == BACKEND_OPENAL && OpenALStream::isValid()) if (backend == BACKEND_OPENAL && OpenALStream::isValid())
g_sound_stream = std::make_unique<OpenALStream>(); g_sound_stream = std::make_unique<OpenALStream>();
else if (backend == BACKEND_NULLSOUND && NullSound::isValid()) else if (backend == BACKEND_NULLSOUND)
g_sound_stream = std::make_unique<NullSound>(); g_sound_stream = std::make_unique<NullSound>();
else if (backend == BACKEND_XAUDIO2) else if (backend == BACKEND_XAUDIO2)
{ {
@ -53,7 +53,7 @@ void InitSoundStream()
else if (backend == BACKEND_OPENSLES && OpenSLESStream::isValid()) else if (backend == BACKEND_OPENSLES && OpenSLESStream::isValid())
g_sound_stream = std::make_unique<OpenSLESStream>(); g_sound_stream = std::make_unique<OpenSLESStream>();
if (!g_sound_stream && NullSound::isValid()) if (!g_sound_stream)
{ {
WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.", backend.c_str(), WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.", backend.c_str(),
BACKEND_NULLSOUND); BACKEND_NULLSOUND);
@ -96,8 +96,7 @@ std::vector<std::string> GetSoundBackends()
{ {
std::vector<std::string> backends; std::vector<std::string> backends;
if (NullSound::isValid()) backends.push_back(BACKEND_NULLSOUND);
backends.push_back(BACKEND_NULLSOUND);
if (XAudio2_7::isValid() || XAudio2::isValid()) if (XAudio2_7::isValid() || XAudio2::isValid())
backends.push_back(BACKEND_XAUDIO2); backends.push_back(BACKEND_XAUDIO2);
if (AOSound::isValid()) if (AOSound::isValid())