Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#8806 - MikMod MOD, S3M, IT, XM player

Attached to Project: Rockbox
Opened by Jason Yu (captainkewl) - Wednesday, 26 March 2008, 07:22 GMT+1
Task Type Patches
Category Plugins
Status Unconfirmed
Assigned To No-one
Player type iPod 5G
Severity Low
Priority Normal
Reported Version current build
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

Player for various tracker module formats supported by MikMod 3.1.12 -- http://sourceforge.net/projects/mikmod/

* All MikMod-supported formats should be playable in theory, though viewers.config is set to recognize only MOD, S3M, IT, and XM. Those four formats are the only ones tested.
* Only tested on iPod 5G. Realtime playback on most mods; some stuttering on more complex IT files like snowf.it
* Had to butcher libmikmod a good bit to get it to compile. As has been noted elsewhere (http://forums.rockbox.org/index.php?topic=4716.msg38535#msg38535), there are colliding namespaces (BOOL, nop) and undefined types (FILE).
* Based on midiplay by Karl Kurbjun
* dbestfit malloc() replacement by Daniel Stenberg
This task depends upon

Comment by Marc Guay (Marc_Guay) - Thursday, 27 March 2008, 00:59 GMT+1
This is amazing. I have a ton of old Impulse Tracker songs lying around and they're playing fine. The loading time is a bit slow and could perhaps use a "Loading..." screen to let the user know it hasn't frozen. Also, the maximum volume seems a bit low, could use a bit of a boost to hear everything nicely.
Comment by Thom Johansen (preglow) - Thursday, 27 March 2008, 19:51 GMT+1
On Coldfire targets, GCC seems to puke on load_mod.c. Don't we love buggy compilers?
Comment by Jason Yu (captainkewl) - Friday, 28 March 2008, 05:38 GMT+1
Seems to build okay after dropping the -O flags. Sorry -- next patch I'll actually test building on other targets.
Comment by Thom Johansen (preglow) - Friday, 28 March 2008, 21:27 GMT+1
Try simulator builds too, while you're at it. There seems to be some system header mismatch here that makes it not work.
Comment by Jason Yu (captainkewl) - Tuesday, 01 April 2008, 20:41 GMT+1
Some platform-specific defines in LibMikMod are tripping things up. I'll post a new version once I've confirmed that it builds OK on OS X too...

What's the word on building things around existing libraries of code? Problems like what we have here could be dealt with definitively by just cutting out the offending blocks, and we could probably do away with a good number of source files altogether. But I'm hesitant to make any substantial changes to anything as it's not really my code and merging any future updates to the original sources might become difficult.
Comment by Thom Johansen (preglow) - Tuesday, 01 April 2008, 20:45 GMT+1
Just be practical. Modifying a lib so much that merging in later changes becomes harder is of course not optimal, but sometimes it needs to be done. I also don't know how much Mikmod is maintained anymore. If future changes are small, merging is less of a concern.
Comment by Jason Yu (captainkewl) - Friday, 04 April 2008, 07:29 GMT+1
* Commented out pretty much all problematic defines
* Tweaked the Makefile for Coldfire building
* Full (Mikmod internal) volume. Should fix some problems with fading.
* Increased get_more call to render 32768, which fixes stuttering in more complex files. I'm not sure if this will cause any adverse effects though -- I didn't see a value this high used in any other plugin.
* Pause uses internal Mikmod pause function. Pausing a song sounds a whole lot nicer now.

Plugging my iPod into my computer's USB port while playing a file causes the file to stop playing and then crashes the iPod when I try to exit. I'm not sure where to even begin to look.
Comment by Craig Mann (inigomontoya) - Sunday, 18 May 2008, 10:59 GMT+1
Now compiles under r17564
Comment by William Peters (w1ll14m) - Thursday, 22 May 2008, 00:46 GMT+1
This is interesting! i still have some XM's around.
only at the moment patch doesn't apply cleanly on svn, might need a resync?
Comment by Craig Mann (inigomontoya) - Thursday, 22 May 2008, 05:21 GMT+1
Sorry about that, my bad. This should fix the messages when patching.
Comment by Craig Mann (inigomontoya) - Thursday, 22 May 2008, 05:22 GMT+1
forgot to attach it
Comment by William Peters (w1ll14m) - Thursday, 22 May 2008, 23:13 GMT+1
Ok, it compiled for my gigabeat S but had to do some small changes.
Here's a patch that i used after i patched my source with mikmod-plugin-3.zip.

It seems mikmod is running atleast at 200% of it's normal speed. sounds funny tho.
Comment by Jason Yu (captainkewl) - Tuesday, 24 June 2008, 23:32 GMT+1
Added handling for USB plug in event. Redid the exit/quit logic and cleaned up some code too. Compiles on current SVN and has corresponding updates for key mappings.

Not sure about the Gigabeat problem as I don't know anything about it and don't have any way to test it, but first guess would be a bad value for SAMPLE_RATE in mikmod_supp.h.
Comment by Jason Yu (captainkewl) - Thursday, 31 July 2008, 07:51 GMT+1
Refresh display when updating info. Also added alternate displays for sample lists, instrument lists (if available), and comments (if available); toggle using Select button. Compiles under r18163.
Comment by Jason Yu (captainkewl) - Saturday, 16 August 2008, 23:07 GMT+1
Compiles under 18298.
Comment by Michael Carr (Strife89) - Tuesday, 09 September 2008, 01:32 GMT+1
And it works beautifully! :)
Comment by Panagiotis Papadopoulos (pano) - Monday, 15 September 2008, 13:54 GMT+1
Is it possible to integrate this patch to show the files in the WPS?
Comment by Panagiotis Papadopoulos (pano) - Monday, 15 September 2008, 23:02 GMT+1
sry the question i wanted to ask is, if it is possible to change the patch, so that the files could be shown in the WPS
Comment by Marc Guay (Marc_Guay) - Wednesday, 17 September 2008, 03:35 GMT+1
Pano: I believe that part of the reason this hasn't been committed yet is that these formats would ideally be treated by a decoder rather than a plugin (whether or not that's a good reason for not accepting a patch is another discussion). But in order for something to be shown in the WPS, as you've requested, a decoder would have to be implemented.
Comment by Ben L (ben8383) - Thursday, 30 October 2008, 19:10 GMT+1
Great patch, thank you! Still have a lot of old xm and it files so I decided to give it a try. Never applied a patch or compiled rockbox myself before, but it was very easy with the VMWare image.
Compiled under r18934 and works without problems on my Sansa c240.
Comment by Robert Menes (RMenes379) - Monday, 03 November 2008, 19:42 GMT+1
I would really like to see this finally be included in the main SVN trunk, but that won't happen unless this is rewritten as a codec and cleaned up a bit.
Comment by Jason Yu (captainkewl) - Tuesday, 04 November 2008, 05:24 GMT+1
I spent some more time recently trying to get a codec working at an acceptable level. The recent merging of the codec and malloc buffers helped, but 1 meg of ram still isn't really good for anything beyond mods and smaller s3ms.
Comment by Dave Chapman (linuxstb) - Tuesday, 04 November 2008, 18:12 GMT+1
Jason,

The new 1MB codec buffer isn't intended to stay at that size forever - the intention is to reduce it as much as possible, which will be especially important as Rockbox starts to work on new targets, some of which only have 1MB or 2MB RAM in total.

I know almost nothing about the formats mikmod plays, but looking briefly at the source code, I see that it supports about 18 different file formats - are these 18 different codecs, or just different ways to store the same thing?

You mention in the first comment that you've only tested four formats - MOD, S3M, IT, and XM. How much of the code is shared between these formats? I'm wondering if (with some build-system magic) it would make sense to build separate codecs for each format? This would minimise the codec size, and also give more scope for optimisation (e.g. IRAM usage).

But even that won't solve the main issue of memory usage. Do you know how much memory each of the four main formats requires? Ideally, codecs like this should use the main audio buffer as working memory, which means the buffering API would need changing to meet the needs of these kinds of codecs. The first step towards this would be to try and define this API - i.e. what memory is needed?

It may be easier to discuss this on IRC.
Comment by Jason Yu (captainkewl) - Friday, 21 November 2008, 23:46 GMT+1
Compiles under r19176.

Loading...