#include AudioSettings::AudioSettings(nlohmann::json &settings) : settings(settings) { lockChannels.setChecked(JSONGetField(settings, "audio", "lock")); volumeL.setValue(JSONGetField(settings, "audio", "volumeL") * 100); volumeR.setValue(JSONGetField(settings, "audio", "volumeR") * 100); } bool AudioSettings::render() { if(lockChannels.render()) { auto isChecked = lockChannels.isChecked(); JSONSetField(settings, "audio", "lock", isChecked); if (isChecked) { volumeR.setValue(volumeL.getValue()); } modified = true; } ImGui::SameLine(); if(volumeL.render()) { float valueL = volumeL.getValue(); JSONSetField(settings, "audio", "volumeL", float(valueL) / 100.f); if (lockChannels.isChecked()) { volumeR.setValue(valueL); JSONSetField(settings, "audio", "volumeR", float(valueL) / 100.f); } modified = true; } ImGui::SameLine(); if(volumeR.render()) { if (!lockChannels.isChecked()) { JSONSetField(settings, "audio", "volumeR", float(volumeR.getValue()) / 100.f); } modified = true; } return modified; }