summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2025-01-04 09:22:17 +0100
committerRoland Reichwein <mail@reichwein.it>2025-01-04 09:22:17 +0100
commit9351c6d9812523b0b8027f2b2e0de54c27004bc2 (patch)
tree6cbf97a8a699630f83bdc1bc93a51736874e82bb /config.cpp
parent0399f008b22482c46d37fa15e6be205b85681011 (diff)
Fix config
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/config.cpp b/config.cpp
index b6460f2..2cd061c 100644
--- a/config.cpp
+++ b/config.cpp
@@ -15,6 +15,16 @@ std::string config_filename = "click.cfg";
Config::Config()
{
+ recover();
+}
+
+Config::~Config()
+{
+ persist();
+}
+
+void Config::recover()
+{
try {
// presets / defaults
m_midi_channel = CLICK_CHANNEL;
@@ -41,7 +51,7 @@ Config::Config()
}
}
-Config::~Config()
+void Config::persist()
{
std::string config = fmt::format("midi_channel={}\n", m_midi_channel) +
fmt::format("midi_note={}\n", m_midi_note) +