MSU-1: Add support for .ogg files, and the .msu1 zip-file format #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains two commits.
The first implements support for loading
.oggfiles as an alternative to.pcmfiles currently supported by emulators for MSU-1 since they are about 10x less heavy in file size than these uncompressed.pcmfiles. Behavior here is to attempt loading a.oggif a.pcmis missing. It also supports aLOOPSTARTcomment in the.oggfiles which contains which sample to loop from - this seems to be somewhat of a de facto standard for use cases that need this?The second commit implements support for a "
.msu1" file format that (at least?) snes9x supports, which is a.zipfile in disguise laid out like this:> zipinfo Something.msu1 Archive: Something.msu1 Zip file size: 31525839 bytes, number of entries: 3 -rw-r--r-- 3.0 unx 4194816 b- stor 24-Apr-03 21:59 program.rom -rw-r--r-- 3.0 unx 27330704 b- stor 23-Jan-27 22:39 track-42.ogg -rw-r--r-- 3.0 unx 7 b- stor 24-Apr-11 22:43 data.msu 3 files, 31525527 bytes uncompressed, 31525527 bytes compressed: 0.0%This format is easier to distribute to the end-user especially since (if stored as an uncompressed
.ziplike in my example) it can still be encoded as a.bpspatch compared to the base rom.In particular the format as snes9x interprets it only cares about whether files end with
-<track number>.(ogg|pcm)or.msufor music or data files respectively, so I've implemented that.To achieve that this modifies the pcm reader and general msu-1 to use
VirtualFiles so that they can load from within an archive. I believe I've implemented that in a way that the data is still streamed if it's not from an archive, but unfortunately.zip-compressed data isn't seekable so it needs to be loaded into memory first?Happy to address any code quality concerns, this is the first time I've really had a more in-depth look at the codebase.