Desktop: HLE audio settings are greyed out when non-HLE audio emulation is selected

This commit is contained in:
OpenSauce04 2024-05-16 22:56:24 +00:00 committed by OpenSauce
parent 81f1848044
commit fd81779233
2 changed files with 12 additions and 0 deletions

View File

@ -49,6 +49,8 @@ ConfigureAudio::ConfigureAudio(bool is_powered_on, QWidget* parent)
&ConfigureAudio::UpdateAudioOutputDevices);
connect(ui->input_type_combo_box, qOverload<int>(&QComboBox::currentIndexChanged), this,
&ConfigureAudio::UpdateAudioInputDevices);
connect(ui->emulation_combo_box, qOverload<int>(&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<s32>(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<int>(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);

View File

@ -35,6 +35,7 @@ private:
void SetInputTypeFromInputType();
void SetInputDeviceFromDeviceID();
void SetVolumeIndicatorText(int percentage);
void SetHleFeaturesEnabled();
void SetupPerGameUI();