Skip to content

support port prefix meta event

I've attached a MIDI file that was causing errors when loading with grig.midi - asteroid_dance_part_1.mid

Initially upon investigating I found the error was caused by a MIDI Meta event that was not handled in the function getEventForType

However there are also other problems with reading this MIDI file in grig.midi aside from the event issue.

The event in question, namely Port Prefix, is probably not widely used and I've seen evidence to suggest it is actually considered obsolete but I've added some code to handle it anyway. As discussed in gitter it might be worth having an Unknown Event type for handling other weird events.

I added an instance of the event to a copy of one of the test MIDI files already in the source and have written a test that looks for the presence of the event. Also added a Channel Prefix event to the same file and a test for that as the code for each is extremely similar and I wanted to be sure that the existing class worked when basing the new one on it.

Merge request reports