mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
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.
This commit is contained in:
@ -22,7 +22,6 @@
|
||||
#include "AudioCommon/WASAPIStream.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
||||
#include "DolphinQt/Config/SettingsWindow.h"
|
||||
@ -200,18 +199,18 @@ void AudioPane::LoadSettings()
|
||||
auto& settings = Settings::Instance();
|
||||
|
||||
// DSP
|
||||
if (SConfig::GetInstance().bDSPHLE)
|
||||
if (Config::Get(Config::MAIN_DSP_HLE))
|
||||
{
|
||||
m_dsp_hle->setChecked(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dsp_lle->setChecked(SConfig::GetInstance().m_DSPEnableJIT);
|
||||
m_dsp_interpreter->setChecked(!SConfig::GetInstance().m_DSPEnableJIT);
|
||||
m_dsp_lle->setChecked(Config::Get(Config::MAIN_DSP_JIT));
|
||||
m_dsp_interpreter->setChecked(!Config::Get(Config::MAIN_DSP_JIT));
|
||||
}
|
||||
|
||||
// Backend
|
||||
const auto current = SConfig::GetInstance().sBackend;
|
||||
const auto current = Config::Get(Config::MAIN_AUDIO_BACKEND);
|
||||
bool selection_set = false;
|
||||
for (const auto& backend : AudioCommon::GetSoundBackends())
|
||||
{
|
||||
@ -231,7 +230,7 @@ void AudioPane::LoadSettings()
|
||||
OnVolumeChanged(settings.GetVolume());
|
||||
|
||||
// DPL2
|
||||
m_dolby_pro_logic->setChecked(SConfig::GetInstance().bDPL2Decoder);
|
||||
m_dolby_pro_logic->setChecked(Config::Get(Config::MAIN_DPL2_DECODER));
|
||||
m_dolby_quality_slider->setValue(int(Config::Get(Config::MAIN_DPL2_QUALITY)));
|
||||
m_dolby_quality_latency_label->setText(
|
||||
GetDPL2ApproximateLatencyLabel(Config::Get(Config::MAIN_DPL2_QUALITY)));
|
||||
@ -242,23 +241,23 @@ void AudioPane::LoadSettings()
|
||||
|
||||
// Latency
|
||||
if (m_latency_control_supported)
|
||||
m_latency_spin->setValue(SConfig::GetInstance().iLatency);
|
||||
m_latency_spin->setValue(Config::Get(Config::MAIN_AUDIO_LATENCY));
|
||||
|
||||
// Stretch
|
||||
m_stretching_enable->setChecked(SConfig::GetInstance().m_audio_stretch);
|
||||
m_stretching_buffer_slider->setValue(SConfig::GetInstance().m_audio_stretch_max_latency);
|
||||
m_stretching_enable->setChecked(Config::Get(Config::MAIN_AUDIO_STRETCH));
|
||||
m_stretching_buffer_slider->setValue(Config::Get(Config::MAIN_AUDIO_STRETCH_LATENCY));
|
||||
m_stretching_buffer_slider->setEnabled(m_stretching_enable->isChecked());
|
||||
m_stretching_buffer_indicator->setText(tr("%1 ms").arg(m_stretching_buffer_slider->value()));
|
||||
|
||||
#ifdef _WIN32
|
||||
if (SConfig::GetInstance().sWASAPIDevice == "default")
|
||||
if (Config::Get(Config::MAIN_WASAPI_DEVICE) == "default")
|
||||
{
|
||||
m_wasapi_device_combo->setCurrentIndex(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_wasapi_device_combo->setCurrentText(
|
||||
QString::fromStdString(SConfig::GetInstance().sWASAPIDevice));
|
||||
QString::fromStdString(Config::Get(Config::MAIN_WASAPI_DEVICE)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -268,24 +267,23 @@ void AudioPane::SaveSettings()
|
||||
auto& settings = Settings::Instance();
|
||||
|
||||
// DSP
|
||||
if (SConfig::GetInstance().bDSPHLE != m_dsp_hle->isChecked() ||
|
||||
SConfig::GetInstance().m_DSPEnableJIT != m_dsp_lle->isChecked())
|
||||
if (Config::Get(Config::MAIN_DSP_HLE) != m_dsp_hle->isChecked() ||
|
||||
Config::Get(Config::MAIN_DSP_JIT) != m_dsp_lle->isChecked())
|
||||
{
|
||||
OnDspChanged();
|
||||
}
|
||||
SConfig::GetInstance().bDSPHLE = m_dsp_hle->isChecked();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_DSP_HLE, m_dsp_hle->isChecked());
|
||||
SConfig::GetInstance().m_DSPEnableJIT = m_dsp_lle->isChecked();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_DSP_JIT, m_dsp_lle->isChecked());
|
||||
|
||||
// Backend
|
||||
const auto selection =
|
||||
m_backend_combo->itemData(m_backend_combo->currentIndex()).toString().toStdString();
|
||||
auto& backend = SConfig::GetInstance().sBackend;
|
||||
std::string backend = Config::Get(Config::MAIN_AUDIO_BACKEND);
|
||||
|
||||
if (selection != backend)
|
||||
{
|
||||
backend = selection;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_BACKEND, selection);
|
||||
OnBackendChanged();
|
||||
}
|
||||
|
||||
@ -297,7 +295,7 @@ void AudioPane::SaveSettings()
|
||||
}
|
||||
|
||||
// DPL2
|
||||
SConfig::GetInstance().bDPL2Decoder = m_dolby_pro_logic->isChecked();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_DPL2_DECODER, m_dolby_pro_logic->isChecked());
|
||||
Config::SetBase(Config::MAIN_DPL2_QUALITY,
|
||||
static_cast<AudioCommon::DPL2Quality>(m_dolby_quality_slider->value()));
|
||||
m_dolby_quality_latency_label->setText(
|
||||
@ -309,16 +307,16 @@ void AudioPane::SaveSettings()
|
||||
|
||||
// Latency
|
||||
if (m_latency_control_supported)
|
||||
SConfig::GetInstance().iLatency = m_latency_spin->value();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_LATENCY, m_latency_spin->value());
|
||||
|
||||
// Stretch
|
||||
SConfig::GetInstance().m_audio_stretch = m_stretching_enable->isChecked();
|
||||
SConfig::GetInstance().m_audio_stretch_max_latency = m_stretching_buffer_slider->value();
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_STRETCH, m_stretching_enable->isChecked());
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_STRETCH_LATENCY, m_stretching_buffer_slider->value());
|
||||
m_stretching_buffer_label->setEnabled(m_stretching_enable->isChecked());
|
||||
m_stretching_buffer_slider->setEnabled(m_stretching_enable->isChecked());
|
||||
m_stretching_buffer_indicator->setEnabled(m_stretching_enable->isChecked());
|
||||
m_stretching_buffer_indicator->setText(
|
||||
tr("%1 ms").arg(SConfig::GetInstance().m_audio_stretch_max_latency));
|
||||
tr("%1 ms").arg(Config::Get(Config::MAIN_AUDIO_STRETCH_LATENCY)));
|
||||
|
||||
#ifdef _WIN32
|
||||
std::string device = "default";
|
||||
@ -326,7 +324,7 @@ void AudioPane::SaveSettings()
|
||||
if (m_wasapi_device_combo->currentIndex() != 0)
|
||||
device = m_wasapi_device_combo->currentText().toStdString();
|
||||
|
||||
SConfig::GetInstance().sWASAPIDevice = device;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_WASAPI_DEVICE, device);
|
||||
#endif
|
||||
|
||||
AudioCommon::UpdateSoundStream();
|
||||
@ -334,7 +332,7 @@ void AudioPane::SaveSettings()
|
||||
|
||||
void AudioPane::OnDspChanged()
|
||||
{
|
||||
const auto backend = SConfig::GetInstance().sBackend;
|
||||
const auto backend = Config::Get(Config::MAIN_AUDIO_BACKEND);
|
||||
|
||||
m_dolby_pro_logic->setEnabled(AudioCommon::SupportsDPL2Decoder(backend) &&
|
||||
!m_dsp_hle->isChecked());
|
||||
@ -344,7 +342,7 @@ void AudioPane::OnDspChanged()
|
||||
|
||||
void AudioPane::OnBackendChanged()
|
||||
{
|
||||
const auto backend = SConfig::GetInstance().sBackend;
|
||||
const auto backend = Config::Get(Config::MAIN_AUDIO_BACKEND);
|
||||
|
||||
m_dolby_pro_logic->setEnabled(AudioCommon::SupportsDPL2Decoder(backend) &&
|
||||
!m_dsp_hle->isChecked());
|
||||
@ -382,13 +380,14 @@ void AudioPane::OnEmulationStateChanged(bool running)
|
||||
m_dsp_interpreter->setEnabled(!running);
|
||||
m_backend_label->setEnabled(!running);
|
||||
m_backend_combo->setEnabled(!running);
|
||||
if (AudioCommon::SupportsDPL2Decoder(SConfig::GetInstance().sBackend) && !m_dsp_hle->isChecked())
|
||||
if (AudioCommon::SupportsDPL2Decoder(Config::Get(Config::MAIN_AUDIO_BACKEND)) &&
|
||||
!m_dsp_hle->isChecked())
|
||||
{
|
||||
m_dolby_pro_logic->setEnabled(!running);
|
||||
EnableDolbyQualityWidgets(!running && m_dolby_pro_logic->isChecked());
|
||||
}
|
||||
if (m_latency_control_supported &&
|
||||
AudioCommon::SupportsLatencyControl(SConfig::GetInstance().sBackend))
|
||||
AudioCommon::SupportsLatencyControl(Config::Get(Config::MAIN_AUDIO_BACKEND)))
|
||||
{
|
||||
m_latency_label->setEnabled(!running);
|
||||
m_latency_spin->setEnabled(!running);
|
||||
|
Reference in New Issue
Block a user