summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon
diff options
context:
space:
mode:
authorshuffle2 <godisgovernment@gmail.com>2017-06-07 21:20:06 -0700
committerGitHub <noreply@github.com>2017-06-07 21:20:06 -0700
commitffd8309aca806a6cf5ca4da85f5854ef14c8e0d9 (patch)
treeba029b5a68e1613f3dca3185a854ef70d05de61e /Source/Core/AudioCommon
parenta2358786dc66eab8fa63987751d4e3fc1a3ee525 (diff)
parent9ee63608b3c7160cadb0291e577b158d1b8aa5c6 (diff)
Merge branch 'master' into fix-unittests
Diffstat (limited to 'Source/Core/AudioCommon')
-rw-r--r--Source/Core/AudioCommon/OpenALStream.cpp31
-rw-r--r--Source/Core/AudioCommon/OpenALStream.h24
-rw-r--r--Source/Core/AudioCommon/XAudio2Stream.cpp3
-rw-r--r--Source/Core/AudioCommon/XAudio2_7Stream.cpp3
4 files changed, 30 insertions, 31 deletions
diff --git a/Source/Core/AudioCommon/OpenALStream.cpp b/Source/Core/AudioCommon/OpenALStream.cpp
index ca343be005..25dd14e7b2 100644
--- a/Source/Core/AudioCommon/OpenALStream.cpp
+++ b/Source/Core/AudioCommon/OpenALStream.cpp
@@ -155,17 +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 surround_capable = SConfig::GetInstance().bDPL2Decoder;
- bool float32_capable = false;
- bool fixed32_capable = false;
+ bool float32_capable = alIsExtensionPresent("AL_EXT_float32") != 0;
+ bool surround_capable = alIsExtensionPresent("AL_EXT_MCFORMATS") || IsCreativeXFi();
+ bool use_surround = SConfig::GetInstance().bDPL2Decoder && surround_capable;
-#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 = IsCreativeXFi();
u32 ulFrequency = m_mixer->GetSampleRate();
numBuffers = SConfig::GetInstance().iLatency + 2; // OpenAL requires a minimum of two buffers
@@ -173,15 +179,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();
@@ -226,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;
@@ -297,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
diff --git a/Source/Core/AudioCommon/OpenALStream.h b/Source/Core/AudioCommon/OpenALStream.h
index 6d32a37adb..5e4b49c027 100644
--- a/Source/Core/AudioCommon/OpenALStream.h
+++ b/Source/Core/AudioCommon/OpenALStream.h
@@ -42,19 +42,23 @@
#define FRAME_SURROUND_INT32 SURROUND_CHANNELS* SIZE_INT32
#endif
-#if defined(__APPLE__)
-// OS X does not have the alext AL_FORMAT_STEREO_FLOAT32, AL_FORMAT_STEREO32,
-// AL_FORMAT_51CHN32 and AL_FORMAT_51CHN16 yet.
-#define AL_FORMAT_STEREO_FLOAT32 0
-#define AL_FORMAT_STEREO32 0
-#define AL_FORMAT_51CHN32 0
-#define AL_FORMAT_51CHN16 0
-#elif defined(_WIN32)
+// From AL_EXT_float32
+#ifndef AL_FORMAT_STEREO_FLOAT32
+#define AL_FORMAT_STEREO_FLOAT32 0x10011
+#endif
+
+// From AL_EXT_MCFORMATS
+#ifndef AL_FORMAT_51CHN16
+#define AL_FORMAT_51CHN16 0x120B
+#endif
+#ifndef AL_FORMAT_51CHN32
+#define AL_FORMAT_51CHN32 0x120C
+#endif
+
// Only X-Fi on Windows supports the alext AL_FORMAT_STEREO32 alext for now,
// but it is not documented or in "OpenAL/include/al.h".
+#ifndef AL_FORMAT_STEREO32
#define AL_FORMAT_STEREO32 0x1203
-#else
-#define AL_FORMAT_STEREO32 0
#endif
class OpenALStream final : public SoundStream
diff --git a/Source/Core/AudioCommon/XAudio2Stream.cpp b/Source/Core/AudioCommon/XAudio2Stream.cpp
index 12954fc5bf..69c503f310 100644
--- a/Source/Core/AudioCommon/XAudio2Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2Stream.cpp
@@ -25,8 +25,7 @@ private:
public:
StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
-
- ~StreamingVoiceContext();
+ virtual ~StreamingVoiceContext();
void Stop();
void Play();
diff --git a/Source/Core/AudioCommon/XAudio2_7Stream.cpp b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
index 06fb645c95..1abf6d2096 100644
--- a/Source/Core/AudioCommon/XAudio2_7Stream.cpp
+++ b/Source/Core/AudioCommon/XAudio2_7Stream.cpp
@@ -25,8 +25,7 @@ private:
public:
StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
-
- ~StreamingVoiceContext2_7();
+ virtual ~StreamingVoiceContext2_7();
void Stop();
void Play();