From 68262f22a05ac74aa28ee52ab6476bc845d6f65d Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 26 Jan 2013 08:46:06 +0100 Subject: Experimental note-off detection. --- lv2/input_lv2.cc | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'lv2') diff --git a/lv2/input_lv2.cc b/lv2/input_lv2.cc index f2efc5e..3659528 100644 --- a/lv2/input_lv2.cc +++ b/lv2/input_lv2.cc @@ -28,6 +28,8 @@ #include +#include + InputLV2::InputLV2() { eventPort = NULL; @@ -76,21 +78,26 @@ event_t *InputLV2::run(size_t pos, size_t len, size_t *nevents) uint8_t* const data = (uint8_t* const)(ev + 1); - if ((data[0] & 0xF0) == 0x90) { + if ((data[0] & 0xF0) == 0x80) { // note off + int key = data[1]; + + DEBUG(lv2input, "Event (off) key:%d\n", key); + } - int key = data[1]; - int velocity = data[2]; + if ((data[0] & 0xF0) == 0x90) { // note on + int key = data[1]; + int velocity = data[2]; - printf("Event key:%d vel:%d\n", key, velocity); + DEBUG(lv2input, "Event key:%d vel:%d\n", key, velocity); - int i = mmap.lookup(key); - if(velocity && i != -1) { - list[listsize].type = TYPE_ONSET; - list[listsize].instrument = i; - list[listsize].velocity = velocity / 127.0; - list[listsize].offset = ev->frames; - listsize++; - } + int i = mmap.lookup(key); + if(velocity && i != -1) { + list[listsize].type = TYPE_ONSET; + list[listsize].instrument = i; + list[listsize].velocity = velocity / 127.0; + list[listsize].offset = ev->frames; + listsize++; + } /* start_frame = ev->frames; plugin->frame = 0; -- cgit v1.2.3