From 2c46e6a464d2ac5be8e16a62fba6f00924090ea8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 23 May 2008 05:16:33 +0000 Subject: Fix infinite loops (and jack death) on internal MIDI nodes (note, trigger, control). git-svn-id: http://svn.drobilla.net/lad/ingen@1231 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/MidiTriggerNode.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/libs/engine/MidiTriggerNode.cpp') diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index 4d7ea000..0ae67c27 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -64,29 +64,28 @@ MidiTriggerNode::process(ProcessContext& context) uint32_t subframes = 0; uint16_t type = 0; uint16_t size = 0; - uint8_t* data = NULL; + uint8_t* buf = NULL; EventBuffer* const midi_in = (EventBuffer*)_midi_in_port->buffer(0); assert(midi_in->this_nframes() == context.nframes()); - while (midi_in->get_event(&frames, &subframes, &type, &size, &data) < context.nframes()) { - + while (midi_in->get_event(&frames, &subframes, &type, &size, &buf)) { const FrameTime time = context.start() + (FrameTime)frames; if (size >= 3) { - switch (data[0] & 0xF0) { + switch (buf[0] & 0xF0) { case MIDI_CMD_NOTE_ON: - if (data[2] == 0) - note_off(data[1], time, context); + if (buf[2] == 0) + note_off(buf[1], time, context); else - note_on(data[1], data[2], time, context); + note_on(buf[1], buf[2], time, context); break; case MIDI_CMD_NOTE_OFF: - note_off(data[1], time, context); + note_off(buf[1], time, context); break; case MIDI_CMD_CONTROL: - if (data[1] == MIDI_CTL_ALL_NOTES_OFF - || data[1] == MIDI_CTL_ALL_SOUNDS_OFF) + if (buf[1] == MIDI_CTL_ALL_NOTES_OFF + || buf[1] == MIDI_CTL_ALL_SOUNDS_OFF) ((AudioBuffer*)_gate_port->buffer(0))->set(0.0f, time); default: break; -- cgit v1.2.1