{"action":"created","issue":{"url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/138","repository_url":"https://api.github.com/repos/Mindwerks/wildmidi","labels_url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/138/labels{/name}","comments_url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/138/comments","events_url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/138/events","html_url":"https://github.com/Mindwerks/wildmidi/issues/138","id":159840288,"number":138,"title":"XMI support is broken","user":{"login":"kcat","id":1545516,"avatar_url":"https://avatars.githubusercontent.com/u/1545516?v=3","gravatar_id":"","url":"https://api.github.com/users/kcat","html_url":"https://github.com/kcat","followers_url":"https://api.github.com/users/kcat/followers","following_url":"https://api.github.com/users/kcat/following{/other_user}","gists_url":"https://api.github.com/users/kcat/gists{/gist_id}","starred_url":"https://api.github.com/users/kcat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kcat/subscriptions","organizations_url":"https://api.github.com/users/kcat/orgs","repos_url":"https://api.github.com/users/kcat/repos","events_url":"https://api.github.com/users/kcat/events{/privacy}","received_events_url":"https://api.github.com/users/kcat/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Mindwerks/wildmidi/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Mindwerks/wildmidi/milestones/2","html_url":"https://github.com/Mindwerks/wildmidi/milestones/0.4%20-%20Now%20with%20more%20support!","labels_url":"https://api.github.com/repos/Mindwerks/wildmidi/milestones/2/labels","id":532400,"number":2,"title":"0.4 - Now with more support!","description":"The goal here is to expand WildMIDI's capabilities in terms of file support.","creator":{"login":"psi29a","id":1122069,"avatar_url":"https://avatars.githubusercontent.com/u/1122069?v=3","gravatar_id":"","url":"https://api.github.com/users/psi29a","html_url":"https://github.com/psi29a","followers_url":"https://api.github.com/users/psi29a/followers","following_url":"https://api.github.com/users/psi29a/following{/other_user}","gists_url":"https://api.github.com/users/psi29a/gists{/gist_id}","starred_url":"https://api.github.com/users/psi29a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psi29a/subscriptions","organizations_url":"https://api.github.com/users/psi29a/orgs","repos_url":"https://api.github.com/users/psi29a/repos","events_url":"https://api.github.com/users/psi29a/events{/privacy}","received_events_url":"https://api.github.com/users/psi29a/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":52,"state":"open","created_at":"2014-01-10T11:54:07Z","updated_at":"2016-06-15T09:13:55Z","due_on":null,"closed_at":null},"comments":24,"created_at":"2016-06-12T18:18:05Z","updated_at":"2016-06-15T09:13:55Z","closed_at":"2016-06-15T09:13:55Z","body":"Trying to play the XMI files in Arena results in many instruments seeming to be missing. Playing back a standard MID file works, but XMI playback seems flawed.\r\n\r\nAfter a quick look at [the source](https://github.com/Mindwerks/wildmidi/blob/master/src/f_xmidi.c), I think the main problem is that WIldMIDI is ignoring the ```TIMB``` chunk. According to [this format description](http://www.shikadi.net/moddingwiki/XMI_Format), the chunk has an array of MIDI patch and bank numbers, and a MIDI program change event actually refers to that array to set both the patch and bank at the same time, rather than specifying the MIDI patch number directly. This could be why most instruments seem to be missing, because it's not setting the correct bank and patch.\r\n\r\nAnother potential issue is with the tempo event. [This page](http://www.vgmpf.com/Wiki/index.php?title=XMI) remarks: \"Tempo events contained in the EVNT chunks should be ignored; they are vestigial remnants of the original MIDI file converted into the XMI format and do not correspond to the values used by the converted event stream.\" However, the XMI loader seems to change the tempo when it comes across it.\r\n\r\nAnd on a more general issue, the loader doesn't seem to do any size checking of the chunk lengths to ensure it's not overrunning the input buffer, and some of the chunk lengths aren't read. XMI is a bastardized format, as it's an IFF container file (which was designed for big-endian systems), while the XMI-related chunks were designed for use on x86. So you end up with chunk sizes specified as big-endian, and the chunk data containing little-endian integers. [Here](https://github.com/Mindwerks/wildmidi/blob/master/src/f_xmidi.c#L89) for example, the ```0x00 0x00 0x00 0x02``` bytes are actually the INFO chunk length (```2``` in 32-bit big-endian, as its a 2-byte chunk), while the chunk itself will typically have ```0x01 0x00``` (```1``` in 16-bit little-endian, for 1 song/form).\r\n\r\nIf I have time, I can try fixing these issues and submitting a pull request, although I can't guarantee when that'll be or how long it'll take to wrap my head around."},"comment":{"url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/comments/226132228","html_url":"https://github.com/Mindwerks/wildmidi/issues/138#issuecomment-226132228","issue_url":"https://api.github.com/repos/Mindwerks/wildmidi/issues/138","id":226132228,"user":{"login":"sezero","id":4222725,"avatar_url":"https://avatars.githubusercontent.com/u/4222725?v=3","gravatar_id":"","url":"https://api.github.com/users/sezero","html_url":"https://github.com/sezero","followers_url":"https://api.github.com/users/sezero/followers","following_url":"https://api.github.com/users/sezero/following{/other_user}","gists_url":"https://api.github.com/users/sezero/gists{/gist_id}","starred_url":"https://api.github.com/users/sezero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sezero/subscriptions","organizations_url":"https://api.github.com/users/sezero/orgs","repos_url":"https://api.github.com/users/sezero/repos","events_url":"https://api.github.com/users/sezero/events{/privacy}","received_events_url":"https://api.github.com/users/sezero/received_events","type":"User","site_admin":false},"created_at":"2016-06-15T09:13:55Z","updated_at":"2016-06-15T09:13:55Z","body":"I guess this can be closed.  If there are still issues, or there are related issues, create a a new bug entry with a reference to this one."}}
{"actor":{"display_login":"sezero"}}