From 39ec820c931b07bc0cec98add36f106a5965e137 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 4 Jan 2025 13:48:34 +0100 Subject: BPM detect --- config.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'config.cpp') diff --git a/config.cpp b/config.cpp index 04736ea..94e881d 100644 --- a/config.cpp +++ b/config.cpp @@ -31,6 +31,7 @@ void Config::recover() m_midi_note = CLICK_NOTE; m_bpm = default_bpm; m_mode = default_mode; + m_output = default_output; std::string config = Reichwein::File::getFile(config_filename); @@ -53,6 +54,10 @@ void Config::recover() m_mode = stoul(i.substr(5)); signal_mode(m_mode); } + if (i.starts_with("output=")) { + m_output = stoul(i.substr(7)); + signal_output(m_output); + } } } catch (const std::exception& ex) { log_cout << "Config not found. Setting config to defaults." << std::endl; @@ -61,10 +66,12 @@ void Config::recover() void Config::persist() { - std::string config = fmt::format("midi_channel={}\n", m_midi_channel) + + std::string config = + fmt::format("midi_channel={}\n", m_midi_channel) + fmt::format("midi_note={}\n", m_midi_note) + fmt::format("bpm={}\n", m_bpm) + - fmt::format("mode={}\n", m_mode); + fmt::format("mode={}\n", m_mode) + + fmt::format("output={}\n", m_output); Reichwein::File::setFile(config_filename, config); } @@ -113,3 +120,14 @@ void Config::set_mode(int mode) signal_mode(mode); } +int Config::get_output() +{ + return m_output; +} + +void Config::set_output(int output) +{ + m_output = output; + signal_output(output); +} + -- cgit v1.2.3