Opened 18 years ago

Closed 17 years ago

Last modified 5 years ago

#8491 closed patch (outdated)

Experimental MikMod support

Reported by: eriktorbjorn Owned by: sev-
Priority: normal Component: Audio
Version: Keywords:
Cc: Game:

Description

This patch adds experimental MikMod support which could possibly be used to play the MOD music from the Amiga versions of some games. Originally, I had planned to support both MikMod and ModPlug, but I decided MikMod was probably much more common.

This code is not particularly well tested, and it does not support seeking. But it's a start.

Ticket imported from: #1372271. Ticket imported from: patches/596.

Attachments (3)

mikmod.diff (11.7 KB ) - added by eriktorbjorn 18 years ago.
Patch against a December 2 CVS snapshot
rjp1_player-20051213.zip (6.6 KB ) - added by cyxx 18 years ago.
RJP1 player for FOTAQ amiga music files
modules.diff (11.7 KB ) - added by Kirben 18 years ago.
Updated mikmod patch, with looping.

Download all attachments as: .zip

Change History (29)

by eriktorbjorn, 18 years ago

Attachment: mikmod.diff added

Patch against a December 2 CVS snapshot

comment:1 by eriktorbjorn, 18 years ago

I should perhaps add that the only thing I've tried so far is replacing a track from the CD version of Monkey Island 1 with a MOD file. That, at least, seems to work.

comment:2 by Kirben, 18 years ago

No offence, but this method of MOD support doesn't seem of any use for Simon the Sorcerer 1. A few points:

1. We need to load MODs from specific files, the current method leaves it hard coded with 'track%d.mod'

2. For the disk versions of Simon the Sorcerer 1 the music needs to be depacked first and can't be loaded directly from a file.

3. Should we require another library for ScummVM? does MikMod support the MOD formats required by other games? or just Simon the Sorcerer 1?

I think it would be best to work out the requirements for MOD support of all games in ScummVM, before adding any code to CVS.

At the moment MOD support is required for the Amiga versions of these games: Inherit the Earth Monkey Island 1 Simon the Sorcerer

Maybe Flight of the Amazon Queen too, if someone was interested in completely code, as recently mentioned on forums.

Simon the Sorcerer 1 needs to play and loop a single MOD, from a single file, stopping the current MOD playing first. Each '%dtune' file contains a single MOD, in Protracker format. But the '%dtune' file can't be loaded directly, since the file is packed in the disk versions.

Monkey Island 1 uses the TFMX format, with music tracks stored in 'music.dat' and sound effects are in 'sample.dat. So needs to read MODs from file offsets, stop specific MODs, loop MODs and play multiple MODs at once (ie sound effects over music).

I'm not sure what the requirements of MOD support in Inherit the Earth are. _sev, could you list details?

comment:3 by Kirben, 18 years ago

Owner: set to sev-

comment:4 by eriktorbjorn, 18 years ago

Well, the file name is only hard-coded as 'track%d.mod' if you play it through the Audio CD manager. It should be possible to create a MOD input stream from any File handle, though I haven't tested this myself yet. I was deliberately modelling the patch on how we support MP3, Ogg Vorbis and FLAC. At the moment, it's more a proof-of-concept than a finished patch.

To support depacking, it should be trivial to extend it to read the MOD data from a stream instead. Then the Simon engine could either have a depacking stream class, or depack it into a buffer and use a memory stream. Maybe.

To support MOD at all, the only ways I see - short of re-inventing the wheel ourselves - is to either depend on another library, or copy the relevant parts of that library into ScummVM. The licenses for MikMod and ModPlug would allow either way, I believe.

I don't know which MOD formats are used by other games. MikMod does support several formats - see http://mikmod.raphnet.net/#features - but it does not support TFMX.

comment:5 by sev-, 18 years ago

It may happen that libmikmod is an overkill.

I know these games which use different flavours of tracker music:

MI1: TFMX. There exists only one awfully writtent player Kyrandia: Max Trax. UADE/deliplayer play it, but do it by means of interpreteting Amiga code, no C equivalents FOTAQ: RichardJosephPlayer. Cyx wrote incomplete implementation for that Simon: Protracker, i.e. plain MOD. ITE: Protracker

I.e. right now out of libmikmod we will use only MOD, which is simplest, stable and very known tracker format.

From the other hand the library has quite nice unified tracker format where all different formats are converted to. So we probably may write/adapt parsers for other formats and maybe even contribute them back to libmikmod or some other open MOD player. But of course this may not work and in this case it would be probably good to strip down libmikmod or find some another smaller MOD->Wav convertor and use that.

comment:6 by SF/kaminari, 18 years ago

I don't know the details of its distribution model, but isn't BassMOD a possible alternative? It's been used in SF and SDL-based projects.

http://un4seen.com/

comment:7 by sev-, 18 years ago

You say something weird. BassMOD is closed sourced, it's precompiled only for four platforms. Moreover, speaking of BASS, you should buy a license for using it.

comment:8 by SF/kaminari, 18 years ago

"The BASS library is free for non-money making use -- if you are not charging for the software (and it has no other commercial purpose, eg. advertising), then you can use BASS in it for free."

You're right about the rest though. Anyway, it was just a suggestion.

comment:9 by fingolfin, 18 years ago

No way we would use this BASS library, they aren't compatible with the GPL spirit at all.

As for TFMX: I thought that this wasn't a MOD format at all...Yeah, some mod players support it, but mostly because it also comes from the Amiga, not because it's MOD.

Homepage of the TFMX creator: <http://www.huelsbeck.com/> XMMS-TFMX plugin (source): <http://xmms-tfmx.sourceforge.net/> CocoModX (OS X player which supports TFMX: <http://cocomod.stalkingwolf.net> The tfmx code CocoModX uses (based on tfmx-play): <http://cocomod.stalkingwolf.net/files/tfmx.zip> TFMX format description: <http://amore68k.netfirms.com/>

comment:10 by fingolfin, 18 years ago

(oh and not to forget: <http://indac.uni-koeln.de/hosted/neochrome/audio.html>)

by cyxx, 18 years ago

Attachment: rjp1_player-20051213.zip added

RJP1 player for FOTAQ amiga music files

comment:11 by cyxx, 18 years ago

Just wanted to mention that I completed my RJP1 player. I'm attaching it here just for reference. I don't know yet when/how this will get integrated to the queen engine... I'll see.

Speaking of TFMX, I second sev, the code for the existing player is hard to follow and apparently all the macros are not implemented.

comment:12 by sev-, 18 years ago

I chat with UADE folks about all of this and got several source codes of different amiga players (in m86k asm of course).

Updated list of Amiga formats used by ScummVM:

MI1: TFMX. Not a MOD format FOTAQ: RichardJosephPlayer. incomplete player attached Simon: Protracker, i.e. plain MOD. ITE: Protracker. Several C implementations exist Gob2, Gob3: Infogrames player (potential target) Kyrandia1: MaxTrax. Well commented source by Joe Pearce :)

For these to be implemented we will need to reimplement our mixer and add on-the-fly resampling ratio change. It will make it slower, so proper solution would be to make it turneable, i.e. for constant rate games (default) it will use current codepath, and for Amiga games it should use different, more complicated one. Probably it could be even done just by subclassing our mixer with Amiga features and use it in appropriate games.

It would be nice to create some set of common routines or something, so it will ease development. It will not be very nice to have 6 completely separated players, but have at least something comming between them (IMHO).

I haven't move more than talking about it due to superbusy-ness with my daily job.

comment:13 by sev-, 18 years ago

A little update (it's better later than never). I've got a MOD tracker from madmoose in excellent shape written on top of OSystem work and consistent with our coding style. Now it's the matter of testing it and commiting.

comment:14 by (none), 18 years ago

As far as I remember, UADE also supports TFMX.

comment:15 by sev-, 18 years ago

As I explained in another bugreport, UADE is not suitable for us. Yes, it can play TFMX, but UADE is plain EaglePlayer. I mean plain, i,e. it is Amiga emulator plus m68k binary code which gets interpreteted. We need pure C++ implementation.

comment:16 by SF/mld, 18 years ago

hej, just a small note about the simon mods /mikmod as modplayer:

Do play them as noisetracker instead of protracker otherwise you get a too strong vibrato/tremolo effect which sounds not 100%.

Secondly... Just to raise awareness. mikmod (and modplug) has big issues with amiga mods and lacks certain features some of the more sophisticated mods use. - However as far I can hear Simon mods seem to be quite plain to be used.

About the tfmx mi1... There's actually a quite good protracker cover of the tfmx-pro music by c.huelsbek on ham [http://advantage.dk/tfxdk//ham/Rips.php]... Not sure if it's complete... Maybe it's easier to hack something up with this. (using hardcoded plist position for the different subsongs).

happy easter,

mld/uade team --- http://zakalwe.fi/uade/

comment:17 by SF/mld, 18 years ago

hmmh, otoh forget the mi1 mod... it's incomplete and since it uses the original instrument samples it's probl. legally off-limits for scummvm to use... sorry

anyway happy easter =:*B

mld/uade team

comment:18 by Kirben, 18 years ago

Due to improved support for Amiga and AtariST versions of AGOS engine based games, support for Protracker music could be very useful now.

I attached an updated version of eriktorbjorn's patch, which allows module music to be played in Amiga/AtariST versions of all AGOS engine based games.

by Kirben, 18 years ago

Attachment: modules.diff added

Updated mikmod patch, with looping.

comment:19 by fingolfin, 17 years ago

Could somebody explain how this patch compares to the "new" code in sound/mods/ ?

comment:20 by eriktorbjorn, 17 years ago

I submitted the patch because I figured it would be easier to use an existing MOD player. I guess it's obsolete now.

comment:21 by Kirben, 17 years ago

This item could be closed now, as Protracker support is covered by ScummVM, which was the main reason for using the MikMod library. Protracker support is working in agos engine, and available for parallaction and saga engines in future, if required.

The Amiga ports currently aren't supported by kyta, queen or saga engines. So would be best to move remaining information to wiki or another tracker item for future reference.

The main format currently required by ScummVM, would be SoundFX format used by cine engine. Which was not part of the previous discussion at all.

comment:22 by fingolfin, 17 years ago

Eugene, can we close this?

comment:23 by sev-, 17 years ago

Yes, as soon as Wiki is up now and I move this info there :)

comment:24 by sev-, 17 years ago

Ok, closing this, as info was moved to Wiki,

comment:25 by sev-, 17 years ago

Resolution: outdated
Status: newclosed

comment:26 by digitall, 5 years ago

Component: Audio
Note: See TracTickets for help on using tickets.