aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg06-fifths.lv2
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-02-08 03:06:27 +0000
committerDavid Robillard <d@drobilla.net>2014-02-08 03:06:27 +0000
commit7553d21abaac2a211f38d6633a8c478e1ddcd292 (patch)
tree693a2ee8e68a9449eb96cfb1db8f92e6f2cedac5 /plugins/eg06-fifths.lv2
parent60eb52f31976763497cd0355cc0d6b46af6c465f (diff)
downloadlv2-7553d21abaac2a211f38d6633a8c478e1ddcd292.tar.xz
Fix off by one and explicitly copy event fields to be a more general example.
Diffstat (limited to 'plugins/eg06-fifths.lv2')
-rw-r--r--plugins/eg06-fifths.lv2/fifths.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/eg06-fifths.lv2/fifths.c b/plugins/eg06-fifths.lv2/fifths.c
index 13d47f4..c7d12e1 100644
--- a/plugins/eg06-fifths.lv2/fifths.c
+++ b/plugins/eg06-fifths.lv2/fifths.c
@@ -139,10 +139,15 @@ run(LV2_Handle instance,
self->out_port, out_capacity, ev);
const uint8_t note = msg[1];
- if (note < 127 - 7) {
+ if (note <= 127 - 7) {
// Make a note one 5th (7 semitones) higher than input
MIDINoteEvent fifth;
- fifth.event = *ev;
+
+ // Could simply do fifth.event = *ev here instead...
+ fifth.event.time.frames = ev->time.frames; // Same time
+ fifth.event.body.type = ev->body.type; // Same type
+ fifth.event.body.size = ev->body.size; // Same size
+
fifth.msg[0] = msg[0]; // Same status
fifth.msg[1] = msg[1] + 7; // Pitch up 7 semitones
fifth.msg[2] = msg[2]; // Same velocity