From 77f2d69d2f9995d7e803021373dbb18a199e645a Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 14 Aug 2012 06:21:53 +0000 Subject: midi: Remove non-standard midi:Tick message type. midi: Add C definitions for message types and standard controllers. midi: Fix definition of SystemExclusive status byte. Use new MIDI API in eg-sampler. --- plugins/eg-sampler.lv2/sampler.c | 9 +++++++-- plugins/eg-sampler.lv2/uris.h | 5 ++--- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'plugins') diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index 3415dcb..28b455b 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -46,6 +46,7 @@ #include "lv2/lv2plug.in/ns/ext/state/state.h" #include "lv2/lv2plug.in/ns/ext/urid/urid.h" #include "lv2/lv2plug.in/ns/ext/worker/worker.h" +#include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "lv2/lv2plug.in/ns/lv2core/lv2.h" #include "./uris.h" @@ -359,11 +360,15 @@ run(LV2_Handle instance, LV2_ATOM_SEQUENCE_FOREACH(self->control_port, ev) { self->frame_offset = ev->time.frames; if (ev->body.type == uris->midi_Event) { - uint8_t* const data = (uint8_t* const)(ev + 1); - if ((data[0] & 0xF0) == 0x90) { + const uint8_t* const msg = (const uint8_t*)(ev + 1); + switch (lv2_midi_message_type(msg)) { + case LV2_MIDI_MSG_NOTE_ON: start_frame = ev->time.frames; self->frame = 0; self->play = true; + break; + default: + break; } } else if (is_object_type(uris, ev->body.type)) { const LV2_Atom_Object* obj = (LV2_Atom_Object*)&ev->body; diff --git a/plugins/eg-sampler.lv2/uris.h b/plugins/eg-sampler.lv2/uris.h index 64ee6b1..3482dda 100644 --- a/plugins/eg-sampler.lv2/uris.h +++ b/plugins/eg-sampler.lv2/uris.h @@ -18,10 +18,9 @@ #ifndef SAMPLER_URIS_H #define SAMPLER_URIS_H -#include "lv2/lv2plug.in/ns/ext/state/state.h" #include "lv2/lv2plug.in/ns/ext/log/log.h" - -#define LV2_MIDI__MidiEvent "http://lv2plug.in/ns/ext/midi#MidiEvent" +#include "lv2/lv2plug.in/ns/ext/midi/midi.h" +#include "lv2/lv2plug.in/ns/ext/state/state.h" #define EG_SAMPLER_URI "http://lv2plug.in/plugins/eg-sampler" #define EG_SAMPLER__file EG_SAMPLER_URI "#file" -- cgit v1.2.1