afegit soport per a configurar el audio (en config i en console)
This commit is contained in:
@@ -527,6 +527,43 @@ namespace Options {
|
||||
}
|
||||
}
|
||||
|
||||
// Carga configuración de audio desde YAML
|
||||
void loadAudioConfigFromYaml(const fkyaml::node& yaml) {
|
||||
if (!yaml.contains("audio")) { return; }
|
||||
const auto& a = yaml["audio"];
|
||||
|
||||
if (a.contains("enabled")) {
|
||||
try { audio.enabled = a["enabled"].get_value<bool>(); } catch (...) {}
|
||||
}
|
||||
if (a.contains("volume")) {
|
||||
try {
|
||||
audio.volume = std::clamp(a["volume"].get_value<float>(), 0.0F, 1.0F);
|
||||
} catch (...) {}
|
||||
}
|
||||
if (a.contains("music")) {
|
||||
const auto& m = a["music"];
|
||||
if (m.contains("enabled")) {
|
||||
try { audio.music.enabled = m["enabled"].get_value<bool>(); } catch (...) {}
|
||||
}
|
||||
if (m.contains("volume")) {
|
||||
try {
|
||||
audio.music.volume = std::clamp(m["volume"].get_value<float>(), 0.0F, 1.0F);
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
if (a.contains("sound")) {
|
||||
const auto& s = a["sound"];
|
||||
if (s.contains("enabled")) {
|
||||
try { audio.sound.enabled = s["enabled"].get_value<bool>(); } catch (...) {}
|
||||
}
|
||||
if (s.contains("volume")) {
|
||||
try {
|
||||
audio.sound.volume = std::clamp(s["volume"].get_value<float>(), 0.0F, 1.0F);
|
||||
} catch (...) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Carga configuración de idioma desde YAML
|
||||
void loadLocalizationFromYaml(const fkyaml::node& yaml) {
|
||||
if (yaml.contains("localization")) {
|
||||
@@ -602,6 +639,7 @@ namespace Options {
|
||||
// Carga las diferentes secciones de configuración usando funciones helper
|
||||
loadWindowConfigFromYaml(yaml);
|
||||
loadVideoConfigFromYaml(yaml);
|
||||
loadAudioConfigFromYaml(yaml);
|
||||
loadKeyboardControlsFromYaml(yaml);
|
||||
loadGamepadControlsFromYaml(yaml);
|
||||
loadKioskConfigFromYaml(yaml);
|
||||
@@ -657,6 +695,19 @@ namespace Options {
|
||||
file << " zoom: " << window.zoom << "\n";
|
||||
file << "\n";
|
||||
|
||||
// AUDIO
|
||||
file << "# AUDIO\n";
|
||||
file << "audio:\n";
|
||||
file << " enabled: " << (audio.enabled ? "true" : "false") << "\n";
|
||||
file << " volume: " << audio.volume << " # 0.0-1.0 (volumen maestro)\n";
|
||||
file << " music:\n";
|
||||
file << " enabled: " << (audio.music.enabled ? "true" : "false") << "\n";
|
||||
file << " volume: " << audio.music.volume << "\n";
|
||||
file << " sound:\n";
|
||||
file << " enabled: " << (audio.sound.enabled ? "true" : "false") << "\n";
|
||||
file << " volume: " << audio.sound.volume << "\n";
|
||||
file << "\n";
|
||||
|
||||
// VIDEO
|
||||
file << "# VIDEO \n";
|
||||
file << "video:\n";
|
||||
|
||||
Reference in New Issue
Block a user