summaryrefslogtreecommitdiff
path: root/Source/Core/AudioCommon/WASAPIStream.cpp
diff options
context:
space:
mode:
authorsowens99 <seanowens@comcast.net>2021-10-13 20:29:04 -0400
committersowens99 <seanowens@comcast.net>2021-10-15 23:24:46 -0400
commit8ea6bef98f535301d23aa1c81d4080c208527705 (patch)
tree52f211ba038b7e1ada0fdc6700c93243689e22b5 /Source/Core/AudioCommon/WASAPIStream.cpp
parent023eb0b7029eb3633ce9eeb039c11d835ea7fd74 (diff)
Port Main.DSP to MainSettings
While trying to work on adding audiodump support for CLI, I was alerted that it was important to first try moving the DSP configs to the new config before continuing, as that makes it substantially easier to write clean code to add such a feature. This commit aims to allow for Dolphin to only rely on the new config for DSP-related settings.
Diffstat (limited to 'Source/Core/AudioCommon/WASAPIStream.cpp')
-rw-r--r--Source/Core/AudioCommon/WASAPIStream.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/Core/AudioCommon/WASAPIStream.cpp b/Source/Core/AudioCommon/WASAPIStream.cpp
index d65471226b..2a15e08195 100644
--- a/Source/Core/AudioCommon/WASAPIStream.cpp
+++ b/Source/Core/AudioCommon/WASAPIStream.cpp
@@ -20,7 +20,7 @@
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
#include "Common/Thread.h"
-#include "Core/ConfigManager.h"
+#include "Core/Config/MainSettings.h"
#include "VideoCommon/OnScreenDisplay.h"
using Microsoft::WRL::ComPtr;
@@ -176,19 +176,19 @@ bool WASAPIStream::SetRunning(bool running)
HRESULT result;
- if (SConfig::GetInstance().sWASAPIDevice == "default")
+ if (Config::Get(Config::MAIN_WASAPI_DEVICE) == "default")
{
result = m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, device.GetAddressOf());
}
else
{
result = S_OK;
- device = GetDeviceByName(SConfig::GetInstance().sWASAPIDevice);
+ device = GetDeviceByName(Config::Get(Config::MAIN_WASAPI_DEVICE));
if (!device)
{
ERROR_LOG_FMT(AUDIO, "Can't find device '{}', falling back to default",
- SConfig::GetInstance().sWASAPIDevice);
+ Config::Get(Config::MAIN_WASAPI_DEVICE));
result = m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, device.GetAddressOf());
}
}
@@ -222,7 +222,7 @@ bool WASAPIStream::SetRunning(bool running)
result = audio_client->GetDevicePeriod(nullptr, &device_period);
- device_period += SConfig::GetInstance().iLatency * (10000 / m_format.Format.nChannels);
+ device_period += Config::Get(Config::MAIN_AUDIO_LATENCY) * (10000 / m_format.Format.nChannels);
INFO_LOG_FMT(AUDIO, "Audio period set to {}", device_period);
if (!HandleWinAPI("Failed to obtain device period", result))
@@ -258,7 +258,7 @@ bool WASAPIStream::SetRunning(bool running)
device_period =
static_cast<REFERENCE_TIME>(
10000.0 * 1000 * m_frames_in_buffer / m_format.Format.nSamplesPerSec + 0.5) +
- SConfig::GetInstance().iLatency * 10000;
+ Config::Get(Config::MAIN_AUDIO_LATENCY) * 10000;
result = audio_client->Initialize(
AUDCLNT_SHAREMODE_EXCLUSIVE,
@@ -333,13 +333,13 @@ void WASAPIStream::SoundLoop()
s16* audio_data = reinterpret_cast<s16*>(data);
GetMixer()->Mix(audio_data, m_frames_in_buffer);
- const SConfig& config = SConfig::GetInstance();
- const bool is_muted = config.m_IsMuted || config.m_Volume == 0;
- const bool need_volume_adjustment = config.m_Volume != 100 && !is_muted;
+ const bool is_muted =
+ Config::Get(Config::MAIN_AUDIO_MUTED) || Config::Get(Config::MAIN_AUDIO_VOLUME) == 0;
+ const bool need_volume_adjustment = Config::Get(Config::MAIN_AUDIO_VOLUME) != 100 && !is_muted;
if (need_volume_adjustment)
{
- const float volume = config.m_Volume / 100.0f;
+ const float volume = Config::Get(Config::MAIN_AUDIO_VOLUME) / 100.0f;
for (u32 i = 0; i < m_frames_in_buffer * 2; i++)
*audio_data++ *= volume;