mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 18:01:56 +00: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:
parent
023eb0b702
commit
8ea6bef98f
26 changed files with 132 additions and 205 deletions
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "Core/Config/FreeLookSettings.h"
|
||||
#include "Core/Config/GraphicsSettings.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/UISettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -329,9 +330,9 @@ void HotkeyScheduler::Run()
|
|||
|
||||
auto ShowVolume = []() {
|
||||
OSD::AddMessage(std::string("Volume: ") +
|
||||
(SConfig::GetInstance().m_IsMuted ?
|
||||
(Config::Get(Config::MAIN_AUDIO_MUTED) ?
|
||||
"Muted" :
|
||||
std::to_string(SConfig::GetInstance().m_Volume) + "%"));
|
||||
std::to_string(Config::Get(Config::MAIN_AUDIO_VOLUME)) + "%"));
|
||||
};
|
||||
|
||||
// Volume
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "Common/CDUtils.h"
|
||||
#include "Core/Boot/Boot.h"
|
||||
#include "Core/CommonTitles.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/RSO.h"
|
||||
|
@ -789,9 +790,9 @@ void MenuBar::AddMovieMenu()
|
|||
|
||||
auto* dump_audio = movie_menu->addAction(tr("Dump Audio"));
|
||||
dump_audio->setCheckable(true);
|
||||
dump_audio->setChecked(SConfig::GetInstance().m_DumpAudio);
|
||||
dump_audio->setChecked(Config::Get(Config::MAIN_DUMP_AUDIO));
|
||||
connect(dump_audio, &QAction::toggled,
|
||||
[](bool value) { SConfig::GetInstance().m_DumpAudio = value; });
|
||||
[](bool value) { Config::SetBaseOrCurrent(Config::MAIN_DUMP_AUDIO, value); });
|
||||
}
|
||||
|
||||
void MenuBar::AddJITMenu()
|
||||
|
|
|
@ -365,14 +365,14 @@ bool Settings::IsKeepWindowOnTopEnabled() const
|
|||
|
||||
int Settings::GetVolume() const
|
||||
{
|
||||
return SConfig::GetInstance().m_Volume;
|
||||
return Config::Get(Config::MAIN_AUDIO_VOLUME);
|
||||
}
|
||||
|
||||
void Settings::SetVolume(int volume)
|
||||
{
|
||||
if (GetVolume() != volume)
|
||||
{
|
||||
SConfig::GetInstance().m_Volume = volume;
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, volume);
|
||||
emit VolumeChanged(volume);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue