summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lv2/input_lv2.cc22
-rw-r--r--src/drumkit.cc9
2 files changed, 22 insertions, 9 deletions
diff --git a/lv2/input_lv2.cc b/lv2/input_lv2.cc
index 23e2c78..f2efc5e 100644
--- a/lv2/input_lv2.cc
+++ b/lv2/input_lv2.cc
@@ -37,16 +37,9 @@ InputLV2::~InputLV2()
{
}
-bool InputLV2::init(Instruments &instruments)
+bool InputLV2::init(Instruments &i)
{
- MidiMapParser p(getenv("DRUMGIZMO_MIDIMAP"));
- if(p.parse()) {/*return false;*/}
- mmap.midimap = p.midimap;
-
- for(size_t i = 0; i < instruments.size(); i++) {
- mmap.instrmap[instruments[i].name()] = i;
- }
-
+ instruments = &i;
return true;
}
@@ -114,6 +107,17 @@ void InputLV2::post()
{
}
+void InputLV2::loadMidiMap(std::string f)
+{
+ MidiMapParser p(f);
+ if(p.parse()) {/*return false;*/}
+ mmap.midimap = p.midimap;
+
+ for(size_t i = 0; i < instruments->size(); i++) {
+ mmap.instrmap[(*instruments)[i]->name()] = i;
+ }
+}
+
#ifdef TEST_INPUT_LV2
//Additional dependency files
//deps:
diff --git a/src/drumkit.cc b/src/drumkit.cc
index d5a066f..00ab2e2 100644
--- a/src/drumkit.cc
+++ b/src/drumkit.cc
@@ -26,6 +26,15 @@
*/
#include "drumkit.h"
+DrumKit::~DrumKit()
+{
+ Instruments::iterator i = instruments.begin();
+ while(i != instruments.end()) {
+ delete *i;
+ i++;
+ }
+}
+
std::string DrumKit::name()
{
return _name;