Settings work

This commit is contained in:
Simone
2024-01-23 13:03:34 +01:00
parent e3cc520fa5
commit 46bb91ec31
9 changed files with 87 additions and 7 deletions

View File

@@ -16,8 +16,10 @@ static inline nlohmann::json JSONOpenOrCreate(const std::string& path) {
} else {
auto file = std::fstream(path, std::fstream::in | std::fstream::out | std::fstream::trunc);
nlohmann::json json;
json["audio"]["volume"] = 0.5;
json["cpu"]["type"] = std::string("interpreter");
json["audio"]["volumeL"] = 0.5;
json["audio"]["volumeR"] = 0.5;
json["audio"]["lock"] = true;
json["cpu"]["type"] = "interpreter";
file << json;
file.close();
@@ -32,6 +34,6 @@ static inline void JSONSetField(nlohmann::json& json, const std::string& field1,
}
template <typename T>
static inline const T& JSONGetField(nlohmann::json& json, const std::string& field1, const std::string& field2) {
return json[field1][field2];
static inline T JSONGetField(nlohmann::json& json, const std::string& field1, const std::string& field2) {
return json[field1][field2].get<T>();
}