AudioCommon: Move logic for default sound backend there from ConfigManager

This way, we don't have to leak the HAVE_ALSA define there.
This commit is contained in:
Florent Castelli
2017-02-05 02:15:38 +01:00
parent 31dfaafe0b
commit 9ebfaa9324
3 changed files with 20 additions and 11 deletions

View File

@ -92,6 +92,22 @@ void ShutdownSoundStream()
INFO_LOG(AUDIO, "Done shutting down sound stream");
}
std::string GetDefaultSoundBackend()
{
std::string backend = BACKEND_NULLSOUND;
#if defined __linux__
if (AlsaSound::isValid())
backend = BACKEND_ALSA;
#elif defined __APPLE__
backend = BACKEND_COREAUDIO;
#elif defined _WIN32
backend = BACKEND_XAUDIO2;
#elif defined ANDROID
backend = BACKEND_OPENSLES;
#endif
return backend;
}
std::vector<std::string> GetSoundBackends()
{
std::vector<std::string> backends;