From 3bfebf396a040ebec81d87fb15fa6ab27cc9241b Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Thu, 30 Mar 2017 13:52:38 -0700 Subject: Fix OpenAL backend on macOS OpenALStream was querying the backend for AL_EXT_float32 support (which suceeds), but AL_FORMAT_STEREO_FLOAT32 was defined incorrectly. Also changes OpenALStream to query for AL_EXT_MCFORMATS (multichannel support) rather than hard-coding that it doesn't work on macOS. --- Source/Core/AudioCommon/OpenALStream.cpp | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'Source/Core/AudioCommon/OpenALStream.cpp') diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index ca343be005..b923522799 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -159,13 +159,14 @@ void OpenALStream::SoundLoop() { Common::SetCurrentThreadName("Audio thread - openal"); - bool surround_capable = SConfig::GetInstance().bDPL2Decoder; - bool float32_capable = false; - bool fixed32_capable = false; + bool float32_capable = alIsExtensionPresent("AL_EXT_float32") != 0; + bool surround_capable = + SConfig::GetInstance().bDPL2Decoder && alIsExtensionPresent("AL_EXT_MCFORMATS"); -#if defined(__APPLE__) - surround_capable = false; -#endif + // As there is no extension to check for 32-bit fixed point support + // and we know that only a X-Fi with hardware OpenAL supports it, + // we just check if one is being used. + bool fixed32_capable = strstr(alGetString(AL_RENDERER), "X-Fi") != nullptr; u32 ulFrequency = m_mixer->GetSampleRate(); numBuffers = SConfig::GetInstance().iLatency + 2; // OpenAL requires a minimum of two buffers @@ -173,15 +174,6 @@ void OpenALStream::SoundLoop() memset(uiBuffers, 0, numBuffers * sizeof(ALuint)); uiSource = 0; - if (alIsExtensionPresent("AL_EXT_float32")) - float32_capable = true; - - // As there is no extension to check for 32-bit fixed point support - // and we know that only a X-Fi with hardware OpenAL supports it, - // we just check if one is being used. - if (strstr(alGetString(AL_RENDERER), "X-Fi")) - fixed32_capable = true; - // Clear error state before querying or else we get false positives. ALenum err = alGetError(); -- cgit v1.2.3 From 60f4f499e8587514409b6de91013e725adce3ce4 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Tue, 6 Jun 2017 15:21:22 -0700 Subject: OpenAL: hardcode that X-Fi supports surround --- Source/Core/AudioCommon/OpenALStream.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Source/Core/AudioCommon/OpenALStream.cpp') diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp index b923522799..25dd14e7b2 100644 --- a/Source/Core/AudioCommon/OpenALStream.cpp +++ b/Source/Core/AudioCommon/OpenALStream.cpp @@ -155,18 +155,23 @@ static ALenum CheckALError(const char* desc) return err; } +static bool IsCreativeXFi() +{ + return strstr(alGetString(AL_RENDERER), "X-Fi") != nullptr; +} + void OpenALStream::SoundLoop() { Common::SetCurrentThreadName("Audio thread - openal"); bool float32_capable = alIsExtensionPresent("AL_EXT_float32") != 0; - bool surround_capable = - SConfig::GetInstance().bDPL2Decoder && alIsExtensionPresent("AL_EXT_MCFORMATS"); + bool surround_capable = alIsExtensionPresent("AL_EXT_MCFORMATS") || IsCreativeXFi(); + bool use_surround = SConfig::GetInstance().bDPL2Decoder && surround_capable; // As there is no extension to check for 32-bit fixed point support // and we know that only a X-Fi with hardware OpenAL supports it, // we just check if one is being used. - bool fixed32_capable = strstr(alGetString(AL_RENDERER), "X-Fi") != nullptr; + bool fixed32_capable = IsCreativeXFi(); u32 ulFrequency = m_mixer->GetSampleRate(); numBuffers = SConfig::GetInstance().iLatency + 2; // OpenAL requires a minimum of two buffers @@ -218,7 +223,7 @@ void OpenALStream::SoundLoop() unsigned int numSamples = OAL_MAX_SAMPLES; - if (surround_capable) + if (use_surround) { // DPL2 accepts 240 samples minimum (FWRDURATION) unsigned int minSamples = 240; @@ -289,7 +294,7 @@ void OpenALStream::SoundLoop() // 5.1 is not supported by the host, fallback to stereo WARN_LOG(AUDIO, "Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue."); - surround_capable = false; + use_surround = false; } } else -- cgit v1.2.3