aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/eg-sampler.lv2/sampler.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-14 06:21:53 +0000
committerDavid Robillard <d@drobilla.net>2012-08-14 06:21:53 +0000
commit77f2d69d2f9995d7e803021373dbb18a199e645a (patch)
tree0cbe74b1be225bd5484fd80aa1aa7441c064dd39 /plugins/eg-sampler.lv2/sampler.c
parente271414476309ef4491444376cf0050936816a24 (diff)
downloadlv2-77f2d69d2f9995d7e803021373dbb18a199e645a.tar.xz
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.
Diffstat (limited to 'plugins/eg-sampler.lv2/sampler.c')
-rw-r--r--plugins/eg-sampler.lv2/sampler.c9
1 files changed, 7 insertions, 2 deletions
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;