summaryrefslogtreecommitdiffstats
path: root/src/server/internals
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-14 06:25:33 +0000
committerDavid Robillard <d@drobilla.net>2012-08-14 06:25:33 +0000
commit50f85edbd0f07135eb73201367bbd256792ee999 (patch)
treefe7b0a459063fb0319fdc82b4b914da09978ae7c /src/server/internals
parent80fee5c311fdbdeda573ec81f59158a5fc87d0a1 (diff)
downloadingen-50f85edbd0f07135eb73201367bbd256792ee999.tar.gz
ingen-50f85edbd0f07135eb73201367bbd256792ee999.tar.bz2
ingen-50f85edbd0f07135eb73201367bbd256792ee999.zip
Use new LV2 MIDI API.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4690 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/internals')
-rw-r--r--src/server/internals/Controller.cpp5
-rw-r--r--src/server/internals/Delay.cpp1
-rw-r--r--src/server/internals/Note.cpp28
-rw-r--r--src/server/internals/Trigger.cpp15
4 files changed, 20 insertions, 29 deletions
diff --git a/src/server/internals/Controller.cpp b/src/server/internals/Controller.cpp
index 62fe0520..7b18366d 100644
--- a/src/server/internals/Controller.cpp
+++ b/src/server/internals/Controller.cpp
@@ -21,7 +21,7 @@
#include "ingen/URIs.hpp"
#include "internals/Controller.hpp"
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
-#include "raul/midi_events.h"
+#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
#include "Buffer.hpp"
#include "Engine.hpp"
@@ -100,7 +100,8 @@ ControllerNode::process(ProcessContext& context)
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
const uint8_t* buf = (const uint8_t*)LV2_ATOM_BODY(&ev->body);
if (ev->body.type == _midi_in_port->bufs().uris().midi_MidiEvent &&
- ev->body.size >= 3 && (buf[0] & 0xF0) == MIDI_CMD_CONTROL) {
+ ev->body.size >= 3 &&
+ lv2_midi_message_type(buf) == LV2_MIDI_MSG_CONTROLLER) {
control(context, buf[1], buf[2], ev->time.frames + context.start());
}
}
diff --git a/src/server/internals/Delay.cpp b/src/server/internals/Delay.cpp
index b6d05f68..0ee0e56d 100644
--- a/src/server/internals/Delay.cpp
+++ b/src/server/internals/Delay.cpp
@@ -23,7 +23,6 @@
#include "raul/Array.hpp"
#include "raul/Maid.hpp"
#include "raul/log.hpp"
-#include "raul/midi_events.h"
#include "Buffer.hpp"
#include "Driver.hpp"
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]);
}
}
diff --git a/src/server/internals/Trigger.cpp b/src/server/internals/Trigger.cpp
index 4745ffbb..f938718f 100644
--- a/src/server/internals/Trigger.cpp
+++ b/src/server/internals/Trigger.cpp
@@ -19,8 +19,8 @@
#include "ingen/URIs.hpp"
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
+#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
#include "raul/log.hpp"
-#include "raul/midi_events.h"
#include "Buffer.hpp"
#include "Engine.hpp"
@@ -102,20 +102,21 @@ TriggerNode::process(ProcessContext& context)
if (ev->body.type == _midi_in_port->bufs().uris().midi_MidiEvent &&
ev->body.size >= 3) {
const FrameTime time = context.start() + ev->time.frames;
- 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:
- if (buf[1] == MIDI_CTL_ALL_NOTES_OFF ||
- buf[1] == MIDI_CTL_ALL_SOUNDS_OFF) {
+ case LV2_MIDI_MSG_CONTROLLER:
+ switch (buf[1]) {
+ case LV2_MIDI_CTL_ALL_NOTES_OFF:
+ case LV2_MIDI_CTL_ALL_SOUNDS_OFF:
_gate_port->set_control_value(context, time, 0.0f);
}
default: