summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ameerj2021-07-08 20:58:38 -0400
committerGravatar ameerj2021-07-08 20:58:38 -0400
commit386cd45f07b83824fc539f8a72429ebf73f5daf4 (patch)
treec0d9ce6b4c6e0db36fac69ee8fc23b2bcb5f9129
parentMerge pull request #6539 from lat9nq/default-setting (diff)
downloadyuzu-386cd45f07b83824fc539f8a72429ebf73f5daf4.tar.gz
yuzu-386cd45f07b83824fc539f8a72429ebf73f5daf4.tar.xz
yuzu-386cd45f07b83824fc539f8a72429ebf73f5daf4.zip
configure_audio: Use u8 for volume value
Diffstat (limited to '')
-rw-r--r--src/common/settings.cpp2
-rw-r--r--src/common/settings.h2
-rw-r--r--src/yuzu/configuration/configure_audio.cpp13
-rw-r--r--src/yuzu_cmd/default_ini.h2
4 files changed, 9 insertions, 10 deletions
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 0061e29cc..c56d14b81 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -103,7 +103,7 @@ float Volume() {
103 if (values.audio_muted) { 103 if (values.audio_muted) {
104 return 0.0f; 104 return 0.0f;
105 } 105 }
106 return values.volume.GetValue(); 106 return values.volume.GetValue() / 100.0f;
107} 107}
108 108
109void RestoreGlobalState(bool is_powered_on) { 109void RestoreGlobalState(bool is_powered_on) {
diff --git a/src/common/settings.h b/src/common/settings.h
index bf83186f5..5305f1ed8 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -278,7 +278,7 @@ struct Values {
278 BasicSetting<std::string> sink_id{"auto", "output_engine"}; 278 BasicSetting<std::string> sink_id{"auto", "output_engine"};
279 BasicSetting<bool> audio_muted{false, "audio_muted"}; 279 BasicSetting<bool> audio_muted{false, "audio_muted"};
280 Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"}; 280 Setting<bool> enable_audio_stretching{true, "enable_audio_stretching"};
281 Setting<float> volume{1.0f, "volume"}; 281 Setting<u8> volume{100, "volume"};
282 282
283 // Core 283 // Core
284 Setting<bool> use_multi_core{true, "use_multi_core"}; 284 Setting<bool> use_multi_core{true, "use_multi_core"};
diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp
index 5aba1a3b2..d8ba939d2 100644
--- a/src/yuzu/configuration/configure_audio.cpp
+++ b/src/yuzu/configuration/configure_audio.cpp
@@ -47,7 +47,8 @@ void ConfigureAudio::SetConfiguration() {
47 47
48 SetAudioDeviceFromDeviceID(); 48 SetAudioDeviceFromDeviceID();
49 49
50 ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); 50 const auto volume_value = Settings::values.volume.GetValue() * ui->volume_slider->maximum();
51 ui->volume_slider->setValue(volume_value / 100);
51 52
52 ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); 53 ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue());
53 54
@@ -112,18 +113,16 @@ void ConfigureAudio::ApplyConfiguration() {
112 113
113 // Guard if during game and set to game-specific value 114 // Guard if during game and set to game-specific value
114 if (Settings::values.volume.UsingGlobal()) { 115 if (Settings::values.volume.UsingGlobal()) {
115 Settings::values.volume.SetValue( 116 const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
116 static_cast<float>(ui->volume_slider->sliderPosition()) / 117 Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
117 ui->volume_slider->maximum());
118 } 118 }
119 } else { 119 } else {
120 if (ui->volume_combo_box->currentIndex() == 0) { 120 if (ui->volume_combo_box->currentIndex() == 0) {
121 Settings::values.volume.SetGlobal(true); 121 Settings::values.volume.SetGlobal(true);
122 } else { 122 } else {
123 Settings::values.volume.SetGlobal(false); 123 Settings::values.volume.SetGlobal(false);
124 Settings::values.volume.SetValue( 124 const s32 volume = ui->volume_slider->sliderPosition() / ui->volume_slider->maximum();
125 static_cast<float>(ui->volume_slider->sliderPosition()) / 125 Settings::values.volume.SetValue(static_cast<u8>(100 * volume));
126 ui->volume_slider->maximum());
127 } 126 }
128 } 127 }
129} 128}
diff --git a/src/yuzu_cmd/default_ini.h b/src/yuzu_cmd/default_ini.h
index cc9850aad..d2a7cd024 100644
--- a/src/yuzu_cmd/default_ini.h
+++ b/src/yuzu_cmd/default_ini.h
@@ -281,7 +281,7 @@ enable_audio_stretching =
281output_device = 281output_device =
282 282
283# Output volume. 283# Output volume.
284# 1.0 (default): 100%, 0.0; mute 284# 100 (default): 100%, 0; mute
285volume = 285volume =
286 286
287[Data Storage] 287[Data Storage]