summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audioinputenginemidi.cc30
-rw-r--r--src/audioinputenginemidi.h4
-rw-r--r--src/drumgizmo.h6
-rw-r--r--src/drumkitparser.cc14
-rw-r--r--src/drumkitparser.h3
-rw-r--r--src/midimapparser.cc17
6 files changed, 33 insertions, 41 deletions
diff --git a/src/audioinputenginemidi.cc b/src/audioinputenginemidi.cc
index 82cafbf..5494462 100644
--- a/src/audioinputenginemidi.cc
+++ b/src/audioinputenginemidi.cc
@@ -28,15 +28,24 @@
#include "midimapparser.h"
+#include "drumgizmo.h"
+
#include <hugin.hpp>
AudioInputEngineMidi::AudioInputEngineMidi()
+ : refs(REFSFILE)
{
+ refs.load();
is_valid = false;
}
-bool AudioInputEngineMidi::loadMidiMap(std::string f, Instruments &instruments)
+bool AudioInputEngineMidi::loadMidiMap(std::string _f, Instruments &instruments)
{
+ std::string f = _f;
+ if(_f.size() > 1 && _f[0] == '@') {
+ f = refs.getValue(_f.substr(1));
+ }
+
file = "";
is_valid = false;
@@ -57,7 +66,7 @@ bool AudioInputEngineMidi::loadMidiMap(std::string f, Instruments &instruments)
mmap.instrmap[instruments[i]->name()] = i;
}
- file = f;
+ file = _f;
is_valid = true;
return true;
@@ -72,20 +81,3 @@ bool AudioInputEngineMidi::isValid()
{
return is_valid;
}
-
-#ifdef TEST_AUDIOINPUTENGINEMIDI
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
-#include "test.h"
-
-TEST_BEGIN;
-
-// TODO: Put some testcode here (see test.h for usable macros).
-
-TEST_END;
-
-#endif/*TEST_AUDIOINPUTENGINEMIDI*/
diff --git a/src/audioinputenginemidi.h b/src/audioinputenginemidi.h
index b01fef0..0868730 100644
--- a/src/audioinputenginemidi.h
+++ b/src/audioinputenginemidi.h
@@ -34,6 +34,8 @@
#include "midimapper.h"
#include "instrument.h"
+#include "configfile.h"
+
class AudioInputEngineMidi : public AudioInputEngine {
public:
AudioInputEngineMidi();
@@ -62,6 +64,8 @@ protected:
MidiMapper mmap;
std::string file;
bool is_valid;
+
+ ConfigFile refs;
};
#endif/*__DRUMGIZMO_AUDIOINPUTENGINEMIDI_H__*/
diff --git a/src/drumgizmo.h b/src/drumgizmo.h
index f8d45f5..5e58ba5 100644
--- a/src/drumgizmo.h
+++ b/src/drumgizmo.h
@@ -47,7 +47,10 @@
#include "chresampler.h"
+#include "configfile.h"
+
#define MAX_NUM_CHANNELS 64
+#define REFSFILE "refs.conf"
class DrumGizmo : public MessageReceiver {
public:
@@ -92,9 +95,6 @@ private:
std::map<std::string, AudioFile *> audiofiles;
-#ifdef TEST_DRUMGIZMO
-public:
-#endif
DrumKit kit;
};
diff --git a/src/drumkitparser.cc b/src/drumkitparser.cc
index 2c21c52..00232b2 100644
--- a/src/drumkitparser.cc
+++ b/src/drumkitparser.cc
@@ -32,10 +32,20 @@
#include "instrumentparser.h"
#include "path.h"
+#include "drumgizmo.h"
-DrumKitParser::DrumKitParser(const std::string &kitfile, DrumKit &k)
+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));
+ }
+
// instr = NULL;
path = getPath(kitfile);
@@ -45,7 +55,7 @@ DrumKitParser::DrumKitParser(const std::string &kitfile, DrumKit &k)
if(!fd) return;
- kit._file = kitfile;
+ kit._file = file;
}
DrumKitParser::~DrumKitParser()
diff --git a/src/drumkitparser.h b/src/drumkitparser.h
index 907b09d..6311609 100644
--- a/src/drumkitparser.h
+++ b/src/drumkitparser.h
@@ -29,6 +29,7 @@
#include "saxparser.h"
#include "drumkit.h"
+#include "configfile.h"
class DrumKitParser : public SAXParser {
public:
@@ -52,6 +53,8 @@ private:
std::string instr_file;
std::string instr_name;
std::string instr_group;
+
+ ConfigFile refs;
};
#endif/*__DRUMGIZMO_DRUMKITPARSER_H__*/
diff --git a/src/midimapparser.cc b/src/midimapparser.cc
index 07210a5..9d30a05 100644
--- a/src/midimapparser.cc
+++ b/src/midimapparser.cc
@@ -50,20 +50,3 @@ int MidiMapParser::readData(char *data, size_t size)
if(!fd) return -1;
return fread(data, 1, size, fd);
}
-
-#ifdef TEST_MIDIMAPPARSER
-//Additional dependency files
-//deps:
-//Required cflags (autoconf vars may be used)
-//cflags:
-//Required link options (autoconf vars may be used)
-//libs:
-#include "test.h"
-
-TEST_BEGIN;
-
-// TODO: Put some testcode here (see test.h for usable macros).
-
-TEST_END;
-
-#endif/*TEST_MIDIMAPPARSER*/