mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 04:07:57 -05:00
configuration: Simplify applying per-game settings
Originally, every time we add a per-game setting, we'd have to guard for it when setting it on the global config, and use a specific function to do it for the per-game config. This moves the global check into the ApplyPerGameSetting function so that we can use it for changing both the global and per-game states. Less work for the programmer.
This commit is contained in:
@ -99,6 +99,10 @@ void ConfigureAudio::SetVolumeIndicatorText(int percentage) {
|
||||
}
|
||||
|
||||
void ConfigureAudio::ApplyConfiguration() {
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
|
||||
ui->toggle_audio_stretching,
|
||||
enable_audio_stretching);
|
||||
|
||||
if (Settings::IsConfiguringGlobal()) {
|
||||
Settings::values.sink_id =
|
||||
ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex())
|
||||
@ -108,19 +112,12 @@ void ConfigureAudio::ApplyConfiguration() {
|
||||
.toStdString();
|
||||
|
||||
// Guard if during game and set to game-specific value
|
||||
if (Settings::values.enable_audio_stretching.UsingGlobal()) {
|
||||
Settings::values.enable_audio_stretching.SetValue(
|
||||
ui->toggle_audio_stretching->isChecked());
|
||||
}
|
||||
if (Settings::values.volume.UsingGlobal()) {
|
||||
Settings::values.volume.SetValue(
|
||||
static_cast<float>(ui->volume_slider->sliderPosition()) /
|
||||
ui->volume_slider->maximum());
|
||||
}
|
||||
} else {
|
||||
ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching,
|
||||
ui->toggle_audio_stretching,
|
||||
enable_audio_stretching);
|
||||
if (ui->volume_combo_box->currentIndex() == 0) {
|
||||
Settings::values.volume.SetGlobal(true);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user