From fd81779233f64bd2cf9d090c691ba85725d39c46 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Thu, 16 May 2024 22:56:24 +0000 Subject: [PATCH] Desktop: HLE audio settings are greyed out when non-HLE audio emulation is selected --- src/lime_qt/configuration/configure_audio.cpp | 11 +++++++++++ src/lime_qt/configuration/configure_audio.h | 1 + 2 files changed, 12 insertions(+) diff --git a/src/lime_qt/configuration/configure_audio.cpp b/src/lime_qt/configuration/configure_audio.cpp index fff5fd034..f714917d9 100644 --- a/src/lime_qt/configuration/configure_audio.cpp +++ b/src/lime_qt/configuration/configure_audio.cpp @@ -49,6 +49,8 @@ ConfigureAudio::ConfigureAudio(bool is_powered_on, QWidget* parent) &ConfigureAudio::UpdateAudioOutputDevices); connect(ui->input_type_combo_box, qOverload(&QComboBox::currentIndexChanged), this, &ConfigureAudio::UpdateAudioInputDevices); + connect(ui->emulation_combo_box, qOverload(&QComboBox::currentIndexChanged), this, + &ConfigureAudio::SetHleFeaturesEnabled); } ConfigureAudio::~ConfigureAudio() {} @@ -65,6 +67,7 @@ void ConfigureAudio::SetConfiguration() { ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); ui->toggle_realtime_audio->setChecked(Settings::values.enable_realtime_audio.GetValue()); + SetHleFeaturesEnabled(); const s32 volume = static_cast(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); @@ -153,6 +156,14 @@ void ConfigureAudio::SetVolumeIndicatorText(int percentage) { ui->volume_indicator->setText(tr("%1%", "Volume percentage (e.g. 50%)").arg(percentage)); } +void ConfigureAudio::SetHleFeaturesEnabled() { + const bool is_hle = + ui->emulation_combo_box->currentIndex() == static_cast(Settings::AudioEmulation::HLE); + + ui->toggle_audio_stretching->setEnabled(is_hle); + ui->toggle_realtime_audio->setEnabled(is_hle); +} + void ConfigureAudio::ApplyConfiguration() { ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, ui->toggle_audio_stretching, audio_stretching); diff --git a/src/lime_qt/configuration/configure_audio.h b/src/lime_qt/configuration/configure_audio.h index b732d79fc..2da6e3eea 100644 --- a/src/lime_qt/configuration/configure_audio.h +++ b/src/lime_qt/configuration/configure_audio.h @@ -35,6 +35,7 @@ private: void SetInputTypeFromInputType(); void SetInputDeviceFromDeviceID(); void SetVolumeIndicatorText(int percentage); + void SetHleFeaturesEnabled(); void SetupPerGameUI();