PedroAlvesV/LuaMidi

Missing META_PREFIX_PORT event

Opened this issue · 1 comments

dcuny commented

Crashed because of missing META_PREFIX_PORT event.

I added it to the CONSTANTS:

   META_CUE_POINT         = 0x07,
   META_PREFIX_PORT       = 0x21,
   META_TEMPO_ID          = 0x51,
   META_TIME_SIGNATURE_ID = 0x58,

and

[33]="Prefix Port", [81] = "Tempo",[88] = "Time Signature",[89] = "Key Signature"}

and it moved past that point, but crashed soon thereafter.

Unfortunately, I can't find a good tool to view the actual MIDI file contents and I haven't had time to dig through your code, so I can't offer a suggestion as to what went wrong next.

dcuny commented

I've still got an odd bug I'm trying to track down, but here are other missing MIDI Events:


local Constants = {
   HEADER_CHUNK_TYPE      = {0x4D, 0x54, 0x68, 0x64}, -- Mthd
   HEADER_CHUNK_LENGTH    = {0x00, 0x00, 0x00, 0x06}, -- Header size for SMF
   HEADER_CHUNK_FORMAT0   = {0x00, 0x00}, -- Midi Type 0 id
   HEADER_CHUNK_FORMAT1   = {0x00, 0x01}, -- Midi Type 1 id
   HEADER_CHUNK_DIVISION  = {0x00, 0x80}, -- Defaults to 128 ticks per beat
   TRACK_CHUNK_TYPE       = {0x4D, 0x54, 0x72, 0x6B}, -- MTrk,
   META_EVENT_ID          = 0xFF,
   META_TEXT_ID           = 0x01,
   META_COPYRIGHT_ID      = 0x02,
   META_TRACK_NAME_ID     = 0x03,
   META_INSTRUMENT_NAME_ID= 0x04,
   META_LYRIC_ID          = 0x05,
   META_MARKER_ID         = 0x06,
   META_CUE_POINT         = 0x07,
   META_CHANNEL_PREFIX    = 0x20,
   META_PREFIX_PORT       = 0x21,
   META_END_OF_TRACK      = 0x2F,
   META_TEMPO_ID          = 0x51,
   META_SMTPE_OFFSET      = 0x54,
   META_TIME_SIGNATURE_ID = 0x58,
   META_KEY_SIGNATURE_ID  = 0x59,
   META_END_OF_TRACK_ID   = {0x2F, 0x00},
   PROGRAM_CHANGE_STATUS  = 0xC0,
   SEQUENCER_SPECIFIC     = 0x7F,
   NOTES                  = {},
   METADATA_TYPES = {"Text","Copyright","Name","Instrument","Lyric","Marker","Cue Point",
      [32] = "Channel Prefix", 
      [33] = "Prefix Port", 
      [47] = "End of Track", 
      [81] = "Tempo",
      [84] = "SMPTE Offset",
      [88] = "Time Signature",
      [89] = "Key Signature",
      [127] = "Sequencer Specific",
    }
}