AudioStream: Re-add SDL backend

This commit is contained in:
Stenzek
2024-03-20 22:46:20 +10:00
parent e70f0e1bc1
commit 9703542775
10 changed files with 185 additions and 13 deletions

View File

@ -365,6 +365,11 @@ std::unique_ptr<AudioStream> Host::CreateAudioStream(AudioBackend backend, u32 s
return AudioStream::CreateCubebAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif
#ifdef ENABLE_SDL2
case AudioBackend::SDL:
return AudioStream::CreateSDLAudioStream(sample_rate, channels, buffer_ms, latency_ms, stretch);
#endif
#ifdef _WIN32
case AudioBackend::XAudio2:
return AudioStream::CreateXAudio2Stream(sample_rate, channels, buffer_ms, latency_ms, stretch);

View File

@ -1559,6 +1559,9 @@ static constexpr const std::array s_audio_backend_names = {
#ifdef ENABLE_CUBEB
"Cubeb",
#endif
#ifdef ENABLE_SDL2
"SDL",
#endif
#ifdef _WIN32
"XAudio2",
#endif
@ -1571,6 +1574,9 @@ static constexpr const std::array s_audio_backend_display_names = {
#ifdef ENABLE_CUBEB
TRANSLATE_NOOP("AudioBackend", "Cubeb"),
#endif
#ifdef ENABLE_SDL2
TRANSLATE_NOOP("AudioBackend", "SDL"),
#endif
#ifdef _WIN32
TRANSLATE_NOOP("AudioBackend", "XAudio2"),
#endif

View File

@ -484,6 +484,8 @@ struct Settings
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::XAudio2;
#elif defined(__ANDROID__)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::AAudio;
#elif defined(ENABLE_SDL2)
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::SDL;
#else
static constexpr AudioBackend DEFAULT_AUDIO_BACKEND = AudioBackend::Null;
#endif

View File

@ -190,6 +190,9 @@ enum class AudioBackend : u8
#ifdef ENABLE_CUBEB
Cubeb,
#endif
#ifdef ENABLE_SDL2
SDL,
#endif
#ifdef _WIN32
XAudio2,
#endif