Note! If you're having problems compiling one of the example apps with "Conversion to Dalvik format failed with error 1" see below. Here's an Android Eclipse library project for AndModPlug (Java wrapper classes + libmodplug). NOTE THAT it's a somewhat experimental build including some modifications I've made for tempo changing and pattern jumping, so beware. At this stage, it's probably best to use the jar and compiled libmodplug.so here. See below for the zip archive. If you use the code, a shout-out via the tweet button above and/or mention in your blog or game credits would be much appreciated! Want to say thanks? If you find my work useful in your projects and would like to say thanks, you can click the button below to see how to donate (via PayPal or just by buying one of the very affordable games :) This is the latest libmodplug (version 0.8.8.4 from sourceforge) built with the almost latest* Android NDK (revision 6b). You'll find AndModLib (JNI stub code + the PlayerThread class) built as a library you can include in your own project, plus two demo apps that use the library to play a few songs. Unlike the earlier version of libmodplug in Android, this version should accept mod, xm files larger than 60K bytes. However, very large mod files may or may not work. Why should you care about tracker music as a developer? Because it can reduce the size of your soundtrack by a factor of 10. See the Soundtracks page for an example of this - an Android apk that uses libmodplug to play the full soundtracks of my games Voyage to Farland and RGBbot! (44 songs in 1.2MB) Steps: 1) download and unzip the archive 2) in Eclipse choose File->Import->Existing Projects into Workspace and select the directory where you unzipped the archive - it should have the three projects in it: AndModPlugLib, AndModPlayerApp & AndModResourcePlayerApp. 3) try out AndModPlayerApp or AndModResourcePlayerApp on your phone or emulator (you might have to clean the projects first - Eclipse is funny about that...) They don't run all that smoothly on the emulator, but you should at least be able to hear it playing music. 4) then you can integrate AndModPlug into your own game or app following the two examples (AndModPlayerApp & AndModResourcePlayerApp) If you want to modify or rebuild AndModPlug, you'll need the Android NDK and cygwin if you're on windows. The AndModPlug project in the archive has a custom Builder to compile libmodplug together with jni_stubs.cpp, but you'll need to go to the sourceforge link above to get the libmodplug source itself (I'm only supplying the Android.mk makefile and jni_stubs.cpp, the JNI stub code), then put all the cpp files into the jni subdirectory. You may also have to modify the Native Builder if you're running Linux, etc.:
Note: under the latest Android SDK and ADT plugin for Eclipse, you might get this error - "Conversion to Dalvik format failed with error 1" while trying to build an app with AndModPlug. Here's how to fix it! Involves removing legacy _src directories for imported libraries. * This was built with the latest Android NDK (r6) as of September 2011. I'll try to build with the newer NDK (r7) soon and update this page - you should still be able to include the library in your own project and play MOD music files, this would only affect people hoping to rebuild and tweak libmodplug from source (and use any new fancy tricks NDK r7 provides that r6 doesn't). Stay tuned for better instructions and code improvements. - crow Thanks to Ryu for the post about native builder arguments here! |


