switch to INI for settings (easier), make settings a singleton thingy, slightly simplify core pause/stop/reset. Drop support for remappable inputs for now
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
#include <AudioSettings.hpp>
|
||||
|
||||
AudioSettings::AudioSettings(nlohmann::json &settings) : settings(settings) {
|
||||
lockChannels.setChecked(JSONGetField<bool>(settings, "audio", "lock"));
|
||||
volumeL.setValue(JSONGetField<float>(settings, "audio", "volumeL") * 100);
|
||||
volumeR.setValue(JSONGetField<float>(settings, "audio", "volumeR") * 100);
|
||||
AudioSettings::AudioSettings() {
|
||||
lockChannels.setChecked(Options::GetInstance().GetValue<bool>("audio", "lock"));
|
||||
volumeL.setValue(Options::GetInstance().GetValue<float>("audio", "volumeL") * 100);
|
||||
volumeR.setValue(Options::GetInstance().GetValue<float>("audio", "volumeR") * 100);
|
||||
}
|
||||
|
||||
bool AudioSettings::render() {
|
||||
if(lockChannels.render()) {
|
||||
auto isChecked = lockChannels.isChecked();
|
||||
JSONSetField(settings, "audio", "lock", isChecked);
|
||||
Options::GetInstance().SetValue("audio", "lock", isChecked);
|
||||
if (isChecked) {
|
||||
volumeR.setValue(volumeL.getValue());
|
||||
}
|
||||
@@ -21,10 +21,10 @@ bool AudioSettings::render() {
|
||||
|
||||
if(volumeL.render()) {
|
||||
float valueL = volumeL.getValue();
|
||||
JSONSetField(settings, "audio", "volumeL", float(valueL) / 100.f);
|
||||
Options::GetInstance().SetValue("audio", "volumeL", float(valueL) / 100.f);
|
||||
if (lockChannels.isChecked()) {
|
||||
volumeR.setValue(valueL);
|
||||
JSONSetField(settings, "audio", "volumeR", float(valueL) / 100.f);
|
||||
Options::GetInstance().SetValue("audio", "volumeR", float(valueL) / 100.f);
|
||||
}
|
||||
|
||||
modified = true;
|
||||
@@ -34,7 +34,7 @@ bool AudioSettings::render() {
|
||||
|
||||
if(volumeR.render()) {
|
||||
if (!lockChannels.isChecked()) {
|
||||
JSONSetField(settings, "audio", "volumeR", float(volumeR.getValue()) / 100.f);
|
||||
Options::GetInstance().SetValue("audio", "volumeR", float(volumeR.getValue()) / 100.f);
|
||||
}
|
||||
|
||||
modified = true;
|
||||
|
||||
Reference in New Issue
Block a user