summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/AudioCommon.cpp
diff options
context:
space:
mode:
authorspycrab <spycrab@users.noreply.github.com>2018-02-10 21:03:27 +0100
committerspycrab <spycrab@users.noreply.github.com>2018-05-26 13:08:10 +0200
commita196dfe50d1d8a2fcd2ffbe5c8eea10687f1698f (patch)
tree74a4c496557048d4f505e66ec5337f82aed44f89 /Source/Core/AudioCommon/AudioCommon.cpp
parent92ec97f8997fbd511406c09d83a79728cae5ec08 (diff)
AudioCommon: Implement WASAPI
Diffstat (limited to 'Source/Core/AudioCommon/AudioCommon.cpp')
-rw-r--r--Source/Core/AudioCommon/AudioCommon.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/Source/Core/AudioCommon/AudioCommon.cpp b/Source/Core/AudioCommon/AudioCommon.cpp
index ceecd4b909..14bef2ce62 100644
--- a/Source/Core/AudioCommon/AudioCommon.cpp
+++ b/Source/Core/AudioCommon/AudioCommon.cpp
@@ -10,6 +10,7 @@
#include "AudioCommon/OpenALStream.h"
#include "AudioCommon/OpenSLESStream.h"
#include "AudioCommon/PulseAudioStream.h"
+#include "AudioCommon/WASAPIStream.h"
#include "AudioCommon/XAudio2Stream.h"
#include "AudioCommon/XAudio2_7Stream.h"
#include "Common/Common.h"
@@ -50,6 +51,8 @@ void InitSoundStream()
g_sound_stream = std::make_unique<PulseAudio>();
else if (backend == BACKEND_OPENSLES && OpenSLESStream::isValid())
g_sound_stream = std::make_unique<OpenSLESStream>();
+ else if (backend == BACKEND_WASAPI && WASAPIStream::isValid())
+ g_sound_stream = std::make_unique<WASAPIStream>();
if (!g_sound_stream || !g_sound_stream->Init())
{
@@ -110,6 +113,9 @@ std::vector<std::string> GetSoundBackends()
backends.push_back(BACKEND_OPENAL);
if (OpenSLESStream::isValid())
backends.push_back(BACKEND_OPENSLES);
+ if (WASAPIStream::isValid())
+ backends.push_back(BACKEND_WASAPI);
+
return backends;
}
@@ -128,7 +134,7 @@ bool SupportsDPL2Decoder(const std::string& backend)
bool SupportsLatencyControl(const std::string& backend)
{
- return backend == BACKEND_OPENAL;
+ return backend == BACKEND_OPENAL || backend == BACKEND_WASAPI;
}
bool SupportsVolumeChanges(const std::string& backend)
@@ -136,7 +142,8 @@ bool SupportsVolumeChanges(const std::string& backend)
// FIXME: this one should ask the backend whether it supports it.
// but getting the backend from string etc. is probably
// too much just to enable/disable a stupid slider...
- return backend == BACKEND_CUBEB || backend == BACKEND_OPENAL || backend == BACKEND_XAUDIO2;
+ return backend == BACKEND_CUBEB || backend == BACKEND_OPENAL || backend == BACKEND_XAUDIO2 ||
+ backend == BACKEND_WASAPI;
}
void UpdateSoundStream()
@@ -231,4 +238,4 @@ void ToggleMuteVolume()
isMuted = !isMuted;
UpdateSoundStream();
}
-}
+} // namespace AudioCommon