summaryrefslogtreecommitdiff
path: root/lv2/input_lv2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lv2/input_lv2.cc')
-rw-r--r--lv2/input_lv2.cc15
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++;