diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-08-09 11:39:30 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2011-08-09 11:39:30 +0200 |
commit | 6611e83df0ed5b9bed42ff8cd549da0b5df11df2 (patch) | |
tree | 89a82a599d5135236f4111eba05a6967f6087c36 /lv2/input_lv2.cc | |
parent | 4920ff67f81b9f0c92ec8330136e6f1e949b040f (diff) |
Use midimapper in LV2 plugin.
Diffstat (limited to 'lv2/input_lv2.cc')
-rw-r--r-- | lv2/input_lv2.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lv2/input_lv2.cc b/lv2/input_lv2.cc index d670505..3092347 100644 --- a/lv2/input_lv2.cc +++ b/lv2/input_lv2.cc @@ -26,6 +26,8 @@ */ #include "input_lv2.h" +#include <midimapparser.h> + InputLV2::InputLV2() { eventPort = NULL; @@ -37,6 +39,14 @@ InputLV2::~InputLV2() bool InputLV2::init(Instruments &instruments) { + MidiMapParser p("/home/deva/docs/c/drumgizmo/kits/test/midimap.xml"); + if(p.parse()) {/*return false;*/} + mmap.midimap = p.midimap; + + for(size_t i = 0; i < instruments.size(); i++) { + mmap.instrmap[instruments[i].name()] = i; + } + return true; } @@ -80,9 +90,10 @@ event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents) //printf("Event key:%d vel:%d\n", key, velocity); - if(velocity) { + int i = mmap.lookup(key); + if(velocity && i != -1) { list[listsize].type = TYPE_ONSET; - list[listsize].instrument = key; + list[listsize].instrument = i; list[listsize].velocity = velocity / 127.0; list[listsize].offset = ev->frames; listsize++; |