From 7553d21abaac2a211f38d6633a8c478e1ddcd292 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 8 Feb 2014 03:06:27 +0000 Subject: Fix off by one and explicitly copy event fields to be a more general example. --- plugins/eg06-fifths.lv2/fifths.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'plugins') 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 -- cgit v1.2.1