summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-11 03:42:52 +0000
committerDavid Robillard <d@drobilla.net>2007-04-11 03:42:52 +0000
commitedbd4d24fd67f8c1c346d9d26ed2a3708a30b684 (patch)
tree67218aaad747f5de2bf36d00c2d428c13e36bb86
parentd33da68e658d171540ceec8f89464783e50267a6 (diff)
downloadlilv-edbd4d24fd67f8c1c346d9d26ed2a3708a30b684.tar.gz
lilv-edbd4d24fd67f8c1c346d9d26ed2a3708a30b684.tar.bz2
lilv-edbd4d24fd67f8c1c346d9d26ed2a3708a30b684.zip
lv2_jack_host MIDI fixes.
git-svn-id: http://svn.drobilla.net/lad/slv2@435 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--hosts/lv2_jack_host.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/hosts/lv2_jack_host.c b/hosts/lv2_jack_host.c
index 62fe0e9..39e9c41 100644
--- a/hosts/lv2_jack_host.c
+++ b/hosts/lv2_jack_host.c
@@ -21,17 +21,13 @@
#include <string.h>
#include <slv2/slv2.h>
#include <jack/jack.h>
-#include "../config.h"
-
-#define WITH_MIDI 1
-#define MIDI_BUFFER_SIZE 1024
-
-#ifdef WITH_MIDI
#include <jack/midiport.h>
+#include "../config.h"
#include "lv2-miditype.h"
#include "lv2-midifunctions.h"
#include "jack_compat.h"
-#endif // WITH_MIDI
+
+#define MIDI_BUFFER_SIZE 1024
struct Port {
SLV2PortID id;
@@ -244,27 +240,25 @@ jack_process_cb(jack_nframes_t nframes, void* data)
} else if (host->ports[p].class == SLV2_MIDI_INPUT) {
void* jack_buffer = jack_port_get_buffer(host->ports[p].jack_port, nframes);
+ lv2midi_reset_buffer(host->ports[p].midi_buffer);
+
LV2_MIDIState state;
lv2midi_reset_state(&state, host->ports[p].midi_buffer, nframes);
- lv2midi_reset_buffer(state.midi);
-
- jack_midi_event_t ev;
const jack_nframes_t event_count
= jack_midi_get_event_count(jack_buffer);
+
+ jack_midi_event_t ev;
for (jack_nframes_t e=0; e < event_count; ++e) {
-
jack_midi_event_get(&ev, jack_buffer, e);
-
- state.midi = host->ports[p].midi_buffer;
lv2midi_put_event(&state, (double)ev.time, ev.size, ev.buffer);
}
+
} else if (host->ports[p].class == SLV2_MIDI_OUTPUT) {
- LV2_MIDIState state;
- lv2midi_reset_state(&state, host->ports[p].midi_buffer, nframes);
- lv2midi_reset_buffer(state.midi);
+ lv2midi_reset_buffer(host->ports[p].midi_buffer);
+
}
}