summaryrefslogtreecommitdiffstats
path: root/src/engine/JackMidiDriver.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-17 00:05:49 +0000
committerDavid Robillard <d@drobilla.net>2008-11-17 00:05:49 +0000
commit1d3834dd534323467a234fb8ad8bc37eab8ebd0e (patch)
tree9e7ae095f59013734c2f9bf18edb28667ec33eee /src/engine/JackMidiDriver.cpp
parent89ebed9d01c1851ca003f6e01d963b1940da9cf9 (diff)
downloadingen-1d3834dd534323467a234fb8ad8bc37eab8ebd0e.tar.gz
ingen-1d3834dd534323467a234fb8ad8bc37eab8ebd0e.tar.bz2
ingen-1d3834dd534323467a234fb8ad8bc37eab8ebd0e.zip
Use LV2 MIDI event type from map instead of hardcoded.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1742 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/JackMidiDriver.cpp')
-rw-r--r--src/engine/JackMidiDriver.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/engine/JackMidiDriver.cpp b/src/engine/JackMidiDriver.cpp
index ecdbd098..0101212c 100644
--- a/src/engine/JackMidiDriver.cpp
+++ b/src/engine/JackMidiDriver.cpp
@@ -20,6 +20,9 @@
#include <pthread.h>
#include "raul/Maid.hpp"
#include "raul/midi_events.h"
+#include "module/World.hpp"
+#include "lv2ext/lv2_event_helpers.h"
+#include "shared/LV2URIMap.hpp"
#include "types.hpp"
#include "JackMidiDriver.hpp"
#include "JackAudioDriver.hpp"
@@ -28,6 +31,7 @@
#include "EventBuffer.hpp"
#include "DuplexPort.hpp"
#include "ProcessContext.hpp"
+#include "Engine.hpp"
#include "jack_compat.h"
using namespace std;
@@ -89,9 +93,8 @@ JackMidiPort::pre_process(ProcessContext& context)
jack_midi_event_t ev;
jack_midi_event_get(&ev, jack_buffer, i);
- // FIXME: type is hardcoded for now, we should get it from
- // the type map instead
- const bool success = patch_buf->append(ev.time, 0, 1, ev.size, ev.buffer);
+ const bool success = patch_buf->append(ev.time, 0, _driver->_midi_event_type,
+ ev.size, ev.buffer);
if (!success)
cerr << "WARNING: Failed to write MIDI to port buffer, event(s) lost!" << endl;
}
@@ -144,11 +147,15 @@ JackMidiPort::post_process(ProcessContext& context)
bool JackMidiDriver::_midi_thread_exit_flag = true;
-JackMidiDriver::JackMidiDriver(jack_client_t* client)
- : _client(client)
+JackMidiDriver::JackMidiDriver(Engine& engine, jack_client_t* client)
+ : _engine(engine)
+ , _client(client)
, _is_activated(false)
, _is_enabled(false)
{
+ const Shared::LV2Features::Feature* f = engine.world()->lv2_features->feature(LV2_URI_MAP_URI);
+ Shared::LV2URIMap* map = (Shared::LV2URIMap*)f->controller;
+ _midi_event_type = map->uri_to_id(NULL, "http://lv2plug.in/ns/ext/midi#MidiEvent");
}