summaryrefslogtreecommitdiff
path: root/lv2
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2013-01-26 08:46:06 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2013-01-26 08:46:06 +0100
commit68262f22a05ac74aa28ee52ab6476bc845d6f65d (patch)
treee793d6f806b91dd35ac38ec3bea408871d53479d /lv2
parentcb220c27929600ff7a1980bbe421290e39b2eddc (diff)
Experimental note-off detection.
Diffstat (limited to 'lv2')
-rw-r--r--lv2/input_lv2.cc31
1 files changed, 19 insertions, 12 deletions
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 <midimapparser.h>
+#include <hugin.hpp>
+
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;