summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-10 01:01:50 +0000
committerDavid Robillard <d@drobilla.net>2011-03-10 01:01:50 +0000
commit2290ef683f154abebe60dfb0392a21325d2a61e0 (patch)
treeab583f4f6d10be58f755dbd380e00cc5b867444b /src
parent7703427f6832cb3195580fda0ab506e7c2948032 (diff)
downloadingen-2290ef683f154abebe60dfb0392a21325d2a61e0.tar.gz
ingen-2290ef683f154abebe60dfb0392a21325d2a61e0.tar.bz2
ingen-2290ef683f154abebe60dfb0392a21325d2a61e0.zip
Use event extension context to map MidiEvent.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3061 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/engine/ControlBindings.cpp14
-rw-r--r--src/engine/JackDriver.cpp4
-rw-r--r--src/engine/events/SetPortValue.cpp3
3 files changed, 15 insertions, 6 deletions
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index 73e0e4c7..7b942008 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -151,8 +151,11 @@ ControlBindings::port_value_changed(ProcessContext& context, PortImpl* port)
default:
break;
}
- if (size > 0)
- _feedback->append(0, 0, uris.midi_MidiEvent.id, size, buf);
+ if (size > 0) {
+ _feedback->append(0, 0,
+ uris.global_to_event(uris.midi_MidiEvent.id).second,
+ size, buf);
+ }
}
}
@@ -340,12 +343,15 @@ ControlBindings::pre_process(ProcessContext& context, EventBuffer* buffer)
const Shared::LV2URIMap& uris = *context.engine().world()->uris().get();
+ // TODO: cache
+ const uint32_t midi_event_type = uris.global_to_event(uris.midi_MidiEvent.id).second;
+
// Learn from input if necessary
if (_learn_port) {
for (buffer->rewind();
buffer->get_event(&frames, &subframes, &type, &size, &buf);
buffer->increment()) {
- if (type != uris.midi_MidiEvent.id)
+ if (type != midi_event_type)
continue;
const Key key = midi_event_key(size, buf, value);
@@ -362,7 +368,7 @@ ControlBindings::pre_process(ProcessContext& context, EventBuffer* buffer)
for (buffer->rewind();
buffer->get_event(&frames, &subframes, &type, &size, &buf);
buffer->increment()) {
- if (type != uris.midi_MidiEvent.id)
+ if (type != midi_event_type)
continue;
const Key key = midi_event_key(size, buf, value);
diff --git a/src/engine/JackDriver.cpp b/src/engine/JackDriver.cpp
index 5b1342cf..5f7a7d83 100644
--- a/src/engine/JackDriver.cpp
+++ b/src/engine/JackDriver.cpp
@@ -30,6 +30,8 @@
#include "raul/log.hpp"
#include "raul/List.hpp"
+#include "lv2/lv2plug.in/ns/ext/event/event.h"
+
#include "AudioBuffer.hpp"
#include "ControlBindings.hpp"
#include "DuplexPort.hpp"
@@ -201,7 +203,7 @@ JackDriver::JackDriver(Engine& engine)
, _root_patch(NULL)
{
_midi_event_type = _engine.world()->uris()->uri_to_id(
- NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
+ LV2_EVENT_URI, "http://lv2plug.in/ns/ext/midi#MidiEvent");
}
diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp
index a8adf658..fd0a9e1a 100644
--- a/src/engine/events/SetPortValue.cpp
+++ b/src/engine/events/SetPortValue.cpp
@@ -164,7 +164,8 @@ SetPortValue::apply(Context& context)
_port->raise_set_by_user_flag();
return;
- } else if (!strcmp(_value.get_blob_type(), "http://lv2plug.in/ns/ext/midi#MidiEvent")) {
+ } else if (!strcmp(_value.get_blob_type(),
+ "http://lv2plug.in/ns/ext/midi#MidiEvent")) {
ebuf->prepare_write(context);
ebuf->append(frames, 0,
uris.global_to_event(uris.midi_MidiEvent.id).second,