diff options
author | Roland Reichwein <mail@reichwein.it> | 2025-01-04 13:48:34 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2025-01-04 13:48:34 +0100 |
commit | 39ec820c931b07bc0cec98add36f106a5965e137 (patch) | |
tree | d1f2f0feb07ff325f363e767181ffaeeab94e20b /config.cpp | |
parent | b2c35cdf69a9084806ac7930cf4475980d596cf6 (diff) |
BPM detect
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -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); +} + |