summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugingui/pluginconfig.cc12
-rw-r--r--plugingui/pluginconfig.h4
-rw-r--r--src/audioinputenginemidi.cc10
-rw-r--r--src/drumkitparser.cc10
4 files changed, 23 insertions, 13 deletions
diff --git a/plugingui/pluginconfig.cc b/plugingui/pluginconfig.cc
index 0beef6e..d4c4477 100644
--- a/plugingui/pluginconfig.cc
+++ b/plugingui/pluginconfig.cc
@@ -39,21 +39,25 @@ Config::~Config()
{
}
-void Config::load()
+bool Config::load()
{
lastkit.clear();
lastmidimap.clear();
- ConfigFile::load();
+ if(!ConfigFile::load()) {
+ return false;
+ }
lastkit = getValue("lastkit");
lastmidimap = getValue("lastmidimap");
+
+ return true;
}
-void Config::save()
+bool Config::save()
{
setValue("lastkit", lastkit);
setValue("lastmidimap", lastmidimap);
- ConfigFile::save();
+ return ConfigFile::save();
}
diff --git a/plugingui/pluginconfig.h b/plugingui/pluginconfig.h
index 29d2ef5..9bef1f0 100644
--- a/plugingui/pluginconfig.h
+++ b/plugingui/pluginconfig.h
@@ -34,8 +34,8 @@ public:
Config();
~Config();
- void load();
- void save();
+ bool load();
+ bool save();
std::string lastkit;
std::string lastmidimap;
diff --git a/src/audioinputenginemidi.cc b/src/audioinputenginemidi.cc
index 5494462..7c1e13d 100644
--- a/src/audioinputenginemidi.cc
+++ b/src/audioinputenginemidi.cc
@@ -35,15 +35,19 @@
AudioInputEngineMidi::AudioInputEngineMidi()
: refs(REFSFILE)
{
- refs.load();
is_valid = false;
}
bool AudioInputEngineMidi::loadMidiMap(std::string _f, Instruments &instruments)
{
std::string f = _f;
- if(_f.size() > 1 && _f[0] == '@') {
- f = refs.getValue(_f.substr(1));
+
+ if(refs.load()) {
+ if(_f.size() > 1 && _f[0] == '@') {
+ f = refs.getValue(_f.substr(1));
+ }
+ } else {
+ ERR(drumkitparser, "Error reading refs.conf");
}
file = "";
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc
index 00232b2..f7bfe40 100644
--- a/src/drumkitparser.cc
+++ b/src/drumkitparser.cc
@@ -38,12 +38,14 @@ DrumKitParser::DrumKitParser(const std::string &file, DrumKit &k)
: kit(k)
, refs(REFSFILE)
{
- refs.load();
-
std::string kitfile = file;
- if(file.size() > 1 && file[0] == '@') {
- kitfile = refs.getValue(file.substr(1));
+ if(refs.load()) {
+ if(file.size() > 1 && file[0] == '@') {
+ kitfile = refs.getValue(file.substr(1));
+ }
+ } else {
+ ERR(drumkitparser, "Error reading refs.conf");
}
// instr = NULL;