Merge pull request #2824 from moncefmechri/bugfix-6001

Use dummy audio backend if the selected backend fails to start
This commit is contained in:
Lioncash 2015-08-09 22:04:14 -04:00
commit 24f3312506
1 changed files with 11 additions and 6 deletions

View File

@ -65,14 +65,19 @@ namespace AudioCommon
if (g_sound_stream) if (g_sound_stream)
{ {
UpdateSoundStream(); UpdateSoundStream();
if (g_sound_stream->Start()) if (!g_sound_stream->Start())
{ {
if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start) ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead",
StartAudioDump(); backend.c_str(), BACKEND_NULLSOUND);
delete g_sound_stream;
return g_sound_stream; g_sound_stream = new NullSound();
g_sound_stream->Start();
} }
PanicAlertT("Could not initialize backend %s.", backend.c_str());
if (SConfig::GetInstance().m_DumpAudio && !s_audio_dump_start)
StartAudioDump();
return g_sound_stream;
} }
PanicAlertT("Sound backend %s is not valid.", backend.c_str()); PanicAlertT("Sound backend %s is not valid.", backend.c_str());