From b9bfe30b1e64285ff7e7d2193c97698aa1b78805 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 7 Jun 2020 01:38:38 +1000 Subject: [PATCH] SDL: Fix compilation on older versions --- src/frontend-common/sdl_audio_stream.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/frontend-common/sdl_audio_stream.cpp b/src/frontend-common/sdl_audio_stream.cpp index 0bf4164f3..c88c7d7a0 100644 --- a/src/frontend-common/sdl_audio_stream.cpp +++ b/src/frontend-common/sdl_audio_stream.cpp @@ -39,7 +39,14 @@ bool SDLAudioStream::OpenDevice() spec.userdata = static_cast(this); SDL_AudioSpec obtained_spec = {}; - m_device_id = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained_spec, SDL_AUDIO_ALLOW_SAMPLES_CHANGE); + +#ifdef SDL_AUDIO_ALLOW_SAMPLES_CHANGE + const u32 allowed_change_flags = SDL_AUDIO_ALLOW_SAMPLES_CHANGE; +#else + const u32 allowed_change_flags = 0; +#endif + + m_device_id = SDL_OpenAudioDevice(nullptr, 0, &spec, &obtained_spec, allowed_change_flags); if (m_device_id == 0) { Log_ErrorPrintf("SDL_OpenAudioDevice() failed: %s", SDL_GetError());