diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-05-28 21:01:56 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-05-28 21:01:56 +0200 |
commit | 773a6ce4d153c6ecc8fb5cf9b41bcf9f25144d7c (patch) | |
tree | 569410bd2daafeea100e9b193f81db42714d5a78 /drumgizmo/input | |
parent | 8abd6ca9586af0b9aa298b9f356c2ce1048566f7 (diff) |
Get rid of haunting assert in input/jackmidi module.
Diffstat (limited to 'drumgizmo/input')
-rw-r--r-- | drumgizmo/input/jackmidi.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drumgizmo/input/jackmidi.cc b/drumgizmo/input/jackmidi.cc index cf4dc6c..445678b 100644 --- a/drumgizmo/input/jackmidi.cc +++ b/drumgizmo/input/jackmidi.cc @@ -110,8 +110,12 @@ void JackMidiInputEngine::process(jack_nframes_t num_frames) void* buffer = jack_port_get_buffer(port->port, num_frames); jack_nframes_t num_events = jack_midi_get_event_count(buffer); - assert(events.empty()); - events.reserve(num_events); + // The event list is assumed to be empty here. + // It might not be though in case the system is under heavy load. + // Make room for both the new and old events to make sure we don't throw + // anything away. + events.reserve(events.size() + num_events); + for(jack_nframes_t i = 0; i < num_events; ++i) { jack_midi_event_t event; |