diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-01-12 16:29:31 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2012-01-12 16:29:31 +0100 |
commit | d63ef52cfd1ca1867542471c3fce4ff5e47b1916 (patch) | |
tree | 65238594e054114d25d5d82ae1e32d208abaa4d6 | |
parent | 62bd868f56a00c0340a0d1e35626ffbef10f5db0 (diff) |
Changed instrument list to containing pointers.
-rw-r--r-- | lv2/input_lv2.cc | 22 | ||||
-rw-r--r-- | src/drumkit.cc | 9 |
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; |