mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-03 20:29:35 +01:00
Gracefully ignore illegal MIDI events.
git-svn-id: svn://localhost/ardour2/branches/3.0@4591 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
473170200d
commit
85ab341795
4 changed files with 31 additions and 10 deletions
|
|
@ -21,9 +21,10 @@
|
|||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <stdint.h>
|
||||
#include "libsmf/smf.h"
|
||||
#include "evoral/Event.hpp"
|
||||
#include "evoral/SMF.hpp"
|
||||
#include "libsmf/smf.h"
|
||||
#include "evoral/midi_util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -201,6 +202,8 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf) const
|
|||
memcpy(*buf, event->midi_buffer, size_t(event_size));
|
||||
*size = event_size;
|
||||
|
||||
assert(midi_event_is_valid(*buf, *size));
|
||||
|
||||
/*printf("SMF::read_event:\n");
|
||||
for (size_t i = 0; i < *size; ++i) {
|
||||
printf("%X ", (*buf)[i]);
|
||||
|
|
@ -224,6 +227,11 @@ SMF::append_event_delta(uint32_t delta_t, uint32_t size, const uint8_t* buf)
|
|||
printf("%X ", buf[i]);
|
||||
} printf("\n");*/
|
||||
|
||||
if (!midi_event_is_valid(buf, size)) {
|
||||
cerr << "WARNING: Ignoring illegal MIDI event" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
smf_event_t* event;
|
||||
|
||||
event = smf_event_new_from_pointer(buf, size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue