diff --git a/include/config.h b/include/config.h index cce674c..c5b27c9 100644 --- a/include/config.h +++ b/include/config.h @@ -14,6 +14,7 @@ public: struct AudioConfig { std::vector devices; + float volume; }; struct SampleConfig { diff --git a/soundboard.json.example b/soundboard.json.example index e16021a..a46bfc4 100644 --- a/soundboard.json.example +++ b/soundboard.json.example @@ -3,7 +3,8 @@ "devices": [ "VirtualMic", "" - ] + ], + "volume": 1.0 }, "shortcuts": { "up": "Shift+Up", diff --git a/src/config_json.cpp b/src/config_json.cpp index 53ef05f..75e0120 100644 --- a/src/config_json.cpp +++ b/src/config_json.cpp @@ -22,6 +22,7 @@ static void writeVector(json& j, const std::vector& v) { void from_json(const json& j, Config::AudioConfig& ac) { readVector(ac.devices, j.value("devices", json::array())); + ac.volume = j.value("volume", 1.0); } void from_json(const json& j, Config::SampleConfig& sc) { @@ -79,6 +80,7 @@ void to_json(json& j, const Config::AudioConfig& ac) { json devarr = json::array(); writeVector(devarr, ac.devices); j["devices"] = devarr; + j["volume"] = ac.volume; } void to_json(json& j, const Config::SampleConfig& sc) {