From edbd4d24fd67f8c1c346d9d26ed2a3708a30b684 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 11 Apr 2007 03:42:52 +0000 Subject: lv2_jack_host MIDI fixes. git-svn-id: http://svn.drobilla.net/lad/slv2@435 a436a847-0d15-0410-975c-d299462d15a1 --- hosts/lv2_jack_host.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'hosts') 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 #include #include -#include "../config.h" - -#define WITH_MIDI 1 -#define MIDI_BUFFER_SIZE 1024 - -#ifdef WITH_MIDI #include +#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); + } } -- cgit v1.2.1