summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
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) +