diff --git a/src/citra/config.cpp b/src/citra/config.cpp index 3cd7bec88..7e83e4160 100644 --- a/src/citra/config.cpp +++ b/src/citra/config.cpp @@ -155,6 +155,7 @@ void Config::ReadValues() { static_cast(sdl2_config->GetInteger("Layout", "custom_bottom_bottom", 480)); // Audio + Settings::values.enable_dsp_lle = sdl2_config->GetBoolean("Audio", "enable_dsp_lle", false); Settings::values.sink_id = sdl2_config->GetString("Audio", "output_engine", "auto"); Settings::values.enable_audio_stretching = sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true); diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index 730809413..5015a1885 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h @@ -167,6 +167,11 @@ custom_bottom_bottom = swap_screen = [Audio] + +# Whether or not to enable DSP LLE +# 0 (default): No, 1: Yes +enable_dsp_lle = + # Which audio output engine to use. # auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available) output_engine = diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index dcbe18122..3dc2de659 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -136,6 +136,7 @@ void Config::ReadValues() { qt_config->endGroup(); qt_config->beginGroup("Audio"); + Settings::values.enable_dsp_lle = ReadSetting("enable_dsp_lle", false).toBool(); Settings::values.sink_id = ReadSetting("output_engine", "auto").toString().toStdString(); Settings::values.enable_audio_stretching = ReadSetting("enable_audio_stretching", true).toBool(); @@ -415,6 +416,7 @@ void Config::SaveValues() { qt_config->endGroup(); qt_config->beginGroup("Audio"); + WriteSetting("enable_dsp_lle", Settings::values.enable_dsp_lle, false); WriteSetting("output_engine", QString::fromStdString(Settings::values.sink_id), "auto"); WriteSetting("enable_audio_stretching", Settings::values.enable_audio_stretching, true); WriteSetting("output_device", QString::fromStdString(Settings::values.audio_device_id), "auto"); diff --git a/src/citra_qt/configuration/configure_audio.cpp b/src/citra_qt/configuration/configure_audio.cpp index 0ab5a3ae4..84bece2b3 100644 --- a/src/citra_qt/configuration/configure_audio.cpp +++ b/src/citra_qt/configuration/configure_audio.cpp @@ -6,6 +6,7 @@ #include "audio_core/sink.h" #include "audio_core/sink_details.h" #include "citra_qt/configuration/configure_audio.h" +#include "core/core.h" #include "core/settings.h" #include "ui_configure_audio.h" @@ -19,6 +20,10 @@ ConfigureAudio::ConfigureAudio(QWidget* parent) ui->output_sink_combo_box->addItem(sink_detail.id); } + ui->emulation_combo_box->addItem(tr("HLE (fast)")); + ui->emulation_combo_box->addItem(tr("LLE (accurate)")); + ui->emulation_combo_box->setEnabled(!Core::System::GetInstance().IsPoweredOn()); + connect(ui->volume_slider, &QSlider::valueChanged, this, &ConfigureAudio::setVolumeIndicatorText); @@ -41,6 +46,8 @@ void ConfigureAudio::setConfiguration() { ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching); ui->volume_slider->setValue(Settings::values.volume * ui->volume_slider->maximum()); setVolumeIndicatorText(ui->volume_slider->sliderPosition()); + + ui->emulation_combo_box->setCurrentIndex(Settings::values.enable_dsp_lle ? 1 : 0); } void ConfigureAudio::setOutputSinkFromSinkID() { @@ -85,6 +92,7 @@ void ConfigureAudio::applyConfiguration() { .toStdString(); Settings::values.volume = static_cast(ui->volume_slider->sliderPosition()) / ui->volume_slider->maximum(); + Settings::values.enable_dsp_lle = ui->emulation_combo_box->currentIndex() == 1; } void ConfigureAudio::updateAudioDevices(int sink_index) { diff --git a/src/citra_qt/configuration/configure_audio.ui b/src/citra_qt/configuration/configure_audio.ui index b80b10d37..1cfbeef37 100644 --- a/src/citra_qt/configuration/configure_audio.ui +++ b/src/citra_qt/configuration/configure_audio.ui @@ -6,7 +6,7 @@ 0 0 - 188 + 240 246 @@ -17,6 +17,23 @@ Audio + + + + 0 + + + + + Emulation: + + + + + + + + diff --git a/src/core/core.cpp b/src/core/core.cpp index 95fa69f43..f2da40704 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -6,6 +6,7 @@ #include #include "audio_core/dsp_interface.h" #include "audio_core/hle/hle.h" +#include "audio_core/lle/lle.h" #include "common/logging/log.h" #include "core/arm/arm_interface.h" #ifdef ARCHITECTURE_x86_64 @@ -188,7 +189,12 @@ System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) { cpu_core = std::make_unique(*this, USER32MODE); } - dsp_core = std::make_unique(*memory); + if (Settings::values.enable_dsp_lle) { + dsp_core = std::make_unique(); + } else { + dsp_core = std::make_unique(*memory); + } + dsp_core->SetSink(Settings::values.sink_id, Settings::values.audio_device_id); dsp_core->EnableStretching(Settings::values.enable_audio_stretching); diff --git a/src/core/settings.cpp b/src/core/settings.cpp index 8bdf5689b..a03115e5b 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -79,6 +79,7 @@ void LogSettings() { LogSetting("Layout_Factor3d", Settings::values.factor_3d); LogSetting("Layout_LayoutOption", static_cast(Settings::values.layout_option)); LogSetting("Layout_SwapScreen", Settings::values.swap_screen); + LogSetting("Audio_EnableDspLle", Settings::values.enable_dsp_lle); LogSetting("Audio_OutputEngine", Settings::values.sink_id); LogSetting("Audio_EnableAudioStretching", Settings::values.enable_audio_stretching); LogSetting("Audio_OutputDevice", Settings::values.audio_device_id); diff --git a/src/core/settings.h b/src/core/settings.h index 929db156c..614323514 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -147,6 +147,7 @@ struct Values { u8 factor_3d; // Audio + bool enable_dsp_lle; std::string sink_id; bool enable_audio_stretching; std::string audio_device_id;