libsmf icon indicating copy to clipboard operation
libsmf copied to clipboard

SMF meta events should not reset running status

Open pauldavisthefirst opened this issue 4 years ago • 0 comments

We use libsmf in Ardour. Recently got a bug report about a file from EZ Drummer that would not load correctly. After a lot of investigation and comparison of parsing routines in midicomp, I realized that the issue was EZ Drummer's use of running status, and the presence of Meta events. The meta event would reset track->last_status to 0xff, leading to much craziness as the next event (a 2 byte note off, using running status) was parsed.

This is the commit from the ardour codebase. Sorry that we don't upstream more of our patches to libsmf, but this one seemed important enough to do so;

`commit 1f86876a0d91c28e00486332ea2480d100a0b4ca (HEAD -> new-ripple-arch) Author: Paul Davis [email protected] Date: Tue Jun 22 14:08:58 2021 -0600

SMF meta-events do not set running status while parsing the file

diff --git a/libs/evoral/libsmf/smf_load.c b/libs/evoral/libsmf/smf_load.c index 2528c328fa..6a6223de0c 100644 --- a/libs/evoral/libsmf/smf_load.c +++ b/libs/evoral/libsmf/smf_load.c @@ -625,7 +625,9 @@ parse_next_event(smf_track_t *track)

c += len;
buffer_length -= len;
  • track->last_status = event->midi_buffer[0];
  • if (!smf_event_is_metadata (event)) {

  •   track->last_status = event->midi_buffer[0];
    
  • } track->next_event_offset += c - start;

    smf_track_add_event_delta_pulses(track, event, etime); `

pauldavisthefirst avatar Jun 22 '21 20:06 pauldavisthefirst