Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSU-1: Add support for .ogg files, and the .msu1 zip-file format #58

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Gutawer
Copy link

@Gutawer Gutawer commented Apr 11, 2024

This PR contains two commits.

The first implements support for loading .ogg files as an alternative to .pcm files currently supported by emulators for MSU-1 since they are about 10x less heavy in file size than these uncompressed .pcm files. Behavior here is to attempt loading a .ogg if a .pcm is missing. It also supports a LOOPSTART comment in the .ogg files 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 .zip file 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 .zip like in my example) it can still be encoded as a .bps patch 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 .msu for 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant