diff options
author | David Robillard <d@drobilla.net> | 2008-05-23 05:16:33 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-05-23 05:16:33 +0000 |
commit | 2c46e6a464d2ac5be8e16a62fba6f00924090ea8 (patch) | |
tree | dd5471166f91ad922e7b8f987a648558a88c45fc /src/libs/engine/MidiTriggerNode.cpp | |
parent | 0dbcca14bcbcb3aa7e7c0ae24934463a5973a651 (diff) | |
download | ingen-2c46e6a464d2ac5be8e16a62fba6f00924090ea8.tar.gz ingen-2c46e6a464d2ac5be8e16a62fba6f00924090ea8.tar.bz2 ingen-2c46e6a464d2ac5be8e16a62fba6f00924090ea8.zip |
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
Diffstat (limited to 'src/libs/engine/MidiTriggerNode.cpp')
-rw-r--r-- | src/libs/engine/MidiTriggerNode.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
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; |