From 50f85edbd0f07135eb73201367bbd256792ee999 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 14 Aug 2012 06:25:33 +0000 Subject: Use new LV2 MIDI API. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4690 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/internals/Note.cpp | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) (limited to 'src/server/internals/Note.cpp') diff --git a/src/server/internals/Note.cpp b/src/server/internals/Note.cpp index 899e01df..c8d1be23 100644 --- a/src/server/internals/Note.cpp +++ b/src/server/internals/Note.cpp @@ -19,10 +19,10 @@ #include "ingen/URIs.hpp" #include "lv2/lv2plug.in/ns/ext/atom/util.h" +#include "lv2/lv2plug.in/ns/ext/midi/midi.h" #include "raul/Array.hpp" #include "raul/Maid.hpp" #include "raul/log.hpp" -#include "raul/midi_events.h" #include "Buffer.hpp" #include "Driver.hpp" @@ -142,48 +142,38 @@ NoteNode::process(ProcessContext& context) Buffer* const midi_in = _midi_in_port->buffer(0).get(); LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)midi_in->atom(); LV2_ATOM_SEQUENCE_FOREACH(seq, ev) { - const uint8_t* buf = (const uint8_t*)LV2_ATOM_BODY(&ev->body); + const uint8_t* buf = (const uint8_t*)LV2_ATOM_BODY_CONST(&ev->body); const FrameTime time = context.start() + (FrameTime)ev->time.frames; if (ev->body.type == _midi_in_port->bufs().uris().midi_MidiEvent && ev->body.size >= 3) { - switch (buf[0] & 0xF0) { - case MIDI_CMD_NOTE_ON: + switch (lv2_midi_message_type(buf)) { + case LV2_MIDI_MSG_NOTE_ON: if (buf[2] == 0) { note_off(context, buf[1], time); } else { note_on(context, buf[1], buf[2], time); } break; - case MIDI_CMD_NOTE_OFF: + case LV2_MIDI_MSG_NOTE_OFF: note_off(context, buf[1], time); break; - case MIDI_CMD_CONTROL: + case LV2_MIDI_MSG_CONTROLLER: switch (buf[1]) { - case MIDI_CTL_ALL_NOTES_OFF: - case MIDI_CTL_ALL_SOUNDS_OFF: + case LV2_MIDI_CTL_ALL_NOTES_OFF: + case LV2_MIDI_CTL_ALL_SOUNDS_OFF: all_notes_off(context, time); break; - case MIDI_CTL_SUSTAIN: + case LV2_MIDI_CTL_SUSTAIN: if (buf[2] > 63) { sustain_on(context, time); } else { sustain_off(context, time); } break; - case MIDI_CMD_BENDER: - // ? - break; - default: - //warn << "Ignored controller " << buf[1] << endl; - break; } - break; default: - //fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buf[0]); break; } - } else { - //fprintf(stderr, "Unknown (size %d) MIDI event %X\n", size, buf[0]); } } -- cgit v1.2.1