39 lines
1.2 KiB
C++
39 lines
1.2 KiB
C++
#include <AudioSettings.hpp>
|
|
#include <imgui.h>
|
|
|
|
AudioSettings::AudioSettings() {
|
|
lockChannels = Options::GetInstance().GetValue<bool>("audio", "lock");
|
|
volumeL = Options::GetInstance().GetValue<float>("audio", "volumeL") * 100;
|
|
volumeR = Options::GetInstance().GetValue<float>("audio", "volumeR") * 100;
|
|
}
|
|
|
|
bool AudioSettings::render() {
|
|
if(ImGui::Checkbox("Lock channels:", &lockChannels)) {
|
|
Options::GetInstance().SetValue("audio", "lock", lockChannels);
|
|
if(lockChannels) {
|
|
volumeR = volumeL;
|
|
Options::GetInstance().SetValue("audio", "volumeR", volumeR / 100.f);
|
|
}
|
|
|
|
modified = true;
|
|
}
|
|
|
|
if(ImGui::SliderFloat("Volume L", &volumeL, 0.f, 100.f, "%.2f")) {
|
|
Options::GetInstance().SetValue("audio", "volumeL", volumeL / 100.f);
|
|
if (lockChannels) {
|
|
volumeR = volumeL;
|
|
Options::GetInstance().SetValue("audio", "volumeR", volumeR / 100.f);
|
|
}
|
|
|
|
modified = true;
|
|
}
|
|
|
|
ImGui::BeginDisabled(lockChannels);
|
|
if(ImGui::SliderFloat("Volume R", &volumeR, 0.f, 100.f, "%.2f")) {
|
|
Options::GetInstance().SetValue("audio", "volumeR", volumeR / 100.f);
|
|
modified = true;
|
|
}
|
|
ImGui::EndDisabled();
|
|
|
|
return modified;
|
|
} |