FS#5311 - MIDI :freeze when "header chunk size invalid"

Attached to Project: Rockbox
Opened by gh (gh) - Sunday, 07 May 2006, 20:35 GMT
Task Type Bugs
Category Music playback
Status Closed
Assigned To No-one
Operating System Iriver H100 series
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


I'm using the CVS build which is right after the commit from 7 May 07:27.
I have put the recommended sound patches, and the MIDI works on most files.
However, I have a problem with that MIDI file :
When loading it, it displays "Header Chunk size invalid." and then freezes, after what i have to reset the H120.
This task depends upon

Closed by  Linus Nielsen Feltzing (linusnielsen)
Monday, 08 May 2006, 12:00 GMT
Reason for closing:  Fixed
Comment by Steve (stevenm86) - Sunday, 07 May 2006, 23:52 GMT
Aah, okay. Thank you. The freezing is a bug that needs to be fixed.
I have checked out the file and it is not regular MIDI. It should have an extension .rmi, and the header on it is in fact 'RIFF' instead the standard 'MTHD'. I hope to add support for this soon; as far as I can remember, .rmi (RIFF) is just a wrapper around a standard MIDI file, which should be the data within the RIFF data block.


00000000 52 49 46 46 1C 10 00 00 52 4D 49 44 64 61 74 61 RIFF....RMIDdata
00000010 0F 10 00 00 4D 54 68 64 00 00 00 06 00 01 00 03 ....MThd.......

Right now I have to go work on a class project but I will look into this within the next few days.

Comment by Steve (stevenm86) - Monday, 08 May 2006, 02:52 GMT
The two things should be fixed in CVS. That file now should play and the loader should gracefully bail out if it sees something weird. As for the actual RIFF header, this is where I am a little confused. They say RIFF is Microsoft's way of prepending a 12-byte header to a MIDI file and calling the result "Windows MIDI". But all in all, there are actually 16 bytes of stuff following the 'RIFF'... so, 20 bytes total. I guess 12 bytes of stuff besides the 'RIFF' and its length field. Who knows? Right now the progra, skips 16 bytes worth of junk and sees a valid MThd header. Let me know if you have other files that refuse to play.

Comment by gh (gh) - Monday, 08 May 2006, 11:55 GMT
The bug is solved, thanks !