From 9351c6d9812523b0b8027f2b2e0de54c27004bc2 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 4 Jan 2025 09:22:17 +0100 Subject: Fix config --- config.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'config.cpp') diff --git a/config.cpp b/config.cpp index b6460f2..2cd061c 100644 --- a/config.cpp +++ b/config.cpp @@ -14,6 +14,16 @@ const char *device = "default"; // playback device std::string config_filename = "click.cfg"; Config::Config() +{ + recover(); +} + +Config::~Config() +{ + persist(); +} + +void Config::recover() { try { // presets / defaults @@ -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) + -- cgit v1.2.3