10 December, 2011

SCUMM v3/v4 AD resource player

A new blog post again, yay!

Over the past weeks I used some of my free time to implement a (standalone) player for SCUMM v3/v4 AdLib music and sound effect resources. I published it in a git repo on github.

This project was born when I wanted to fix a few shortcomings with our AD support in ScummVM. A well known problem of our ScummVM implementation is that some sound effects are off. For example the door opening and closing sound effect in Monkey Island. There is a bit of information and most notably some recordings of that over here . Also we do not "loop" some sound effects correclty, most notable is the Indiana Jones 3 waterfall sound effect, see here. Technically these sound effects are not looped, but just have an infinite play time though. We also have some minor bug for music files, where (sometimes) the note frequencies do not exactly match the original.

My current adplayer should have none of these issues. I checked its OPL register writes for the beginning of the Monkey Island 1 intro and some sound effects, i.e. the door opening and the typewriter, in Indy3 and they matched the original interpreter. It's not well tested enough to say it's totally bug free though ;-).

One of the main problems with integrating the code in ScummVM would be to ensure savegame compatibility. This is a problem because to properly support the sound effects, we would need to implement a non-iMuse based player and hook that up instead of iMuse. Now all old savegames might contain iMuse save data and we would need to come up with a way to properly detect and skip/handle it. It might be notable that this is also an issue when you load savegames, which were made when you had AdLib sound configured, in a configuration which has PC Speaker or Creative Music System configured as output device.

Another problem is that we have support for what we call "Mixed AdLib/MIDI mode", which improves the game experience when using a MIDI device by playing AdLib resources when there is no (MT-32) MIDI data for sound resources (at least in the case of SCUMM). This feature is currently implemented via some magic in the iMuse code. Since we always play the MIDI data of SCUMM games via our iMuse implementation and as far as I know we cannot use a non-iMuse based output as fallback right now, adding my code would break "Mixed AdLib/MIDI mode" support for The Secret of Monkey Island for example.

Maybe I will find some time to look into how to fix these issues. For now I am happy to listen to some good game music outside of ScummVM ;-).