mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 13:45:43 +01:00
Load what we can from broken/truncated MIDI files.
We're still a very long way from tolerant of weird SMF files (libsmf takes a "crash if input is not exactly perfect" philosophy, if we're going to be polite and elevate such a thing to "philosophy"), but at least we'll get what's there from files truncated by old broken versions of Ardour or other situations.
This commit is contained in:
parent
4facff3b8e
commit
168d187994
4 changed files with 74 additions and 44 deletions
|
|
@ -286,7 +286,11 @@ SMF::read_event(uint32_t* delta_t, uint32_t* size, uint8_t** buf, event_id_t* no
|
|||
memcpy(*buf, event->midi_buffer, size_t(event_size));
|
||||
*size = event_size;
|
||||
|
||||
assert(midi_event_is_valid(*buf, *size));
|
||||
if (!midi_event_is_valid(*buf, *size)) {
|
||||
cerr << "WARNING: SMF ignoring illegal MIDI event" << endl;
|
||||
*size = 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* printf("SMF::read_event @ %u: ", *delta_t);
|
||||
for (size_t i = 0; i < *size; ++i) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue