Volume slider that adjusts how loud games are on a global level (#3240)

* Update config.cpp

* Update config.h

* Update sdl_audio.cpp

* Update settings_dialog.cpp

* Update settings_dialog.h

* Update settings_dialog.ui

* Update gui_settings.h

* Update audioout.cpp

* Update audioout.h

* Update settings_dialog.cpp

* remove leftover settings_dialog.ui

* Update settings_dialog.ui

---------

Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
This commit is contained in:
UltraDaCat
2025-07-18 10:20:05 +02:00
committed by GitHub
parent e914099ae2
commit fafd3fb564
9 changed files with 304 additions and 168 deletions

View File

@@ -32,6 +32,7 @@ std::filesystem::path find_fs_path_or(const basic_value<TC>& v, const K& ky,
namespace Config {
// General
static int volumeSlider = 100;
static bool isNeo = false;
static bool isDevKit = false;
static bool isPSNSignedIn = false;
@@ -108,6 +109,9 @@ static std::string trophyKey = "";
// Expected number of items in the config file
static constexpr u64 total_entries = 54;
int getVolumeSlider() {
return volumeSlider;
}
bool allowHDR() {
return isHDRAllowed;
}
@@ -157,6 +161,10 @@ std::filesystem::path GetSaveDataPath() {
return save_data_path;
}
void setVolumeSlider(int volumeValue) {
volumeSlider = volumeValue;
}
void setLoadGameSizeEnabled(bool enable) {
load_game_size = enable;
}
@@ -611,6 +619,7 @@ void load(const std::filesystem::path& path) {
if (data.contains("General")) {
const toml::value& general = data.at("General");
volumeSlider = toml::find_or<int>(general, "volumeSlider", volumeSlider);
isNeo = toml::find_or<bool>(general, "isPS4Pro", isNeo);
isDevKit = toml::find_or<bool>(general, "isDevKit", isDevKit);
isPSNSignedIn = toml::find_or<bool>(general, "isPSNSignedIn", isPSNSignedIn);
@@ -806,6 +815,7 @@ void save(const std::filesystem::path& path) {
fmt::print("Saving new configuration file {}\n", fmt::UTF(path.u8string()));
}
data["General"]["volumeSlider"] = volumeSlider;
data["General"]["isPS4Pro"] = isNeo;
data["General"]["isDevKit"] = isDevKit;
data["General"]["isPSNSignedIn"] = isPSNSignedIn;
@@ -901,6 +911,7 @@ void save(const std::filesystem::path& path) {
void setDefaultValues() {
// General
volumeSlider = 100;
isNeo = false;
isDevKit = false;
isPSNSignedIn = false;

View File

@@ -19,6 +19,8 @@ enum HideCursorState : int { Never, Idle, Always };
void load(const std::filesystem::path& path);
void save(const std::filesystem::path& path);
int getVolumeSlider();
void setVolumeSlider(int volumeValue);
std::string getTrophyKey();
void setTrophyKey(std::string key);
bool getIsFullscreen();