From 2199efa523f8d0ba2a4776966087f3ccf4d1c9e7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 28 Mar 2016 22:16:59 +0200 Subject: Fix midi event iteration loop when encountering a non-midi event. --- pluginlv2.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pluginlv2.cc b/pluginlv2.cc index 477f30a..39d0e6c 100644 --- a/pluginlv2.cc +++ b/pluginlv2.cc @@ -301,10 +301,9 @@ void PluginLV2::run(LV2_Handle instance, uint32_t sample_count) auto& event_port = plugin_lv2->input_event_ports[port]; - LV2_Atom_Event* ev = lv2_atom_sequence_begin(&event_port->body); - while(!lv2_atom_sequence_is_end(&event_port->body, - event_port->atom.size, - ev)) + for(LV2_Atom_Event* ev = lv2_atom_sequence_begin(&event_port->body); + !lv2_atom_sequence_is_end(&event_port->body, event_port->atom.size, ev); + ev = lv2_atom_sequence_next(ev)) { if(ev->body.type != plugin_lv2->map->map(plugin_lv2->map->handle, LV2_MIDI__MidiEvent)) @@ -314,8 +313,6 @@ void PluginLV2::run(LV2_Handle instance, uint32_t sample_count) const char* data = (char*)(ev + 1); input_events.emplace_back(ev->time.frames, data, ev->body.size); - - ev = lv2_atom_sequence_next(ev); } } -- cgit v1.2.3