summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp22
1 files changed, 20 insertions, 2 deletions
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);
+}
+