Jump to content
Tuts 4 You

xm library for 64bit


Recommended Posts

I'm looking for a C/C++ library for xm module playback that works in 64bit mode. ufmod is x86 only, fmod is too bloated, minifmod has tons of inline asm, bass doesnt seem to have an x64 explicit bassmod, and even then I'd need the DLL, irrKlang is x86 only, too.

I'm pretty much running out of options here, I'm thankful for any suggestion. :flowers:

  • Like 1
Link to comment

I'm facing the same problem and I didn't find a working solution. That is a reason why everyone should hate and avoid inline assembly. This really really sucks! Using google is useless too, because it looks like every entry is refering to bassmod, fmod or ufmod.

The best option I found is:

Use this

dumbplay.c is a working player. The big problem is allegro: http://alleg.sourceforge.net

But I think it is still the best option to create a static lib. Haven't tried it yet. I hope the resulting filesize is small...

If you have a working solution please post it.

Link to comment

I just had another go at googling and found some more. libmikmod, libmodplug and the milkytracker source.

Maybe next week I have a few hours to try and compile and implement one of these, will update this thread with any progress.

  • Like 1
Link to comment


I got libmodplug to compile (1 MB static lib :0) but I'm struggling to get sound to work. ufMOD source is a PITA, 5 minutes of skimming through the source gave me a rough idea but I'm nowhere near having a clue. Been fiddling around with WinMM but no luck so far. Is DirectSound a good alternative? The code looks simple but I just realized I need to get the DirectX SDK and the platform SDK to even compile.

  • Like 1
Link to comment

After some trial and error I got libmodplug to play music, currently just reading a 20 second buffer and feeding it to waveOut. So it's really just some details to work on (thread, backbuffer, etc.) and nothing that can't be found on CodeProject :)

The real problem however, is the size:

The binary went from 140kb (static CRT!) to 340kb (linking to CRT dlls). I guess this can be tweaked a good amount by removing the entire code that deals with all the other module formats (there are tons!). While that won't be as good as ufMODs 5 or so kb but 20-30kb for the entire lib should be perfectly doable.

PS: The sound is way better than uFMOD, too :sorc:

Edited by Killboy
  • Like 1
Link to comment

Hi Killboy!

Perhaps yu can try mikwin, the port of Libmikmod.

Its directsound included.

to make it small yu have to clean from all other formats.


Link to comment

Thanks for the link.

I read that libmikmod is a little buggy but I don't plan on throwing samples at it, I only use one file for keygen background music etc. so it's perfect for my needs.

Nice to see some DirectSound code, too.

  • Like 1
Link to comment

ufmod needs only 7 imports with WINMMM and that is really great.

ufmod is already used by the most keygencoders. but its not ready for 64 bit.

Killboy needs a 64bit combatible lib. i think a c-lib is better to convert than a asm-lib as ufmod!


Let us know if yu're happy! ;)

Edited by hmi222
Link to comment

@Aguila: the lib explicitly supports MSVC and compiles without problems on both architectures.

The sound part is not all that tricky, most libs are designed to produce plain old PCM data which pretty much any sound API understands.

Now all you have to do is implement the WINMM code yourself, that's where I'm stuck right now. Just read that it deadlocks in some situations, so now it's full-blown threads and events. But hey, where's the fun in just grabbing stuff that works out of the box :zorro:

  • Like 1
Link to comment

Here's the result of my adventures:

I tried getting mikmod to just output PCM to a buffer but didn't find out just how to do it the proper way, maybe sometime in the future.

Thanks for your help! :flowers:

  • Like 1
Link to comment
  • 2 weeks later...

killboy can yu give this a try?

ive no X64 machine.

Its mikwin 64bit compiled,

with all replayers.

if its running we can strip it to only XM!

its with directsound.

yu have to include dsound

Best regards



Link to comment

I've played some XMs, ITs, MODs and S3Ms with it.

It plays everything w/o crashes, but the sound

is as if it would apply 'hall' effect on everything.

Also especially when playing XMs there's a noticeable

clicking sound in the background: mw64.7z

Link to comment

yep, sounds a little bit like vinyl :dunno:

according to the readme it's a sync problem but I doubt that...I always figured if click sounds appear it's a ****ty decoder, or maybe some bug in the DirectSound code on new OSs or whatever

Link to comment

yep, sounds a little bit like vinyl :dunno:

according to the readme it's a sync problem but I doubt that...I always figured if click sounds appear it's a ****ty decoder, or maybe some bug in the DirectSound code on new OSs or whatever

I compiled to 32bit x86 as DLL with the delivered PlayerCode as ConsoleApp.

I stripped it to play only XM.

But the clicks too... we had a closer look into.

Mikwin+DLL in 32bit x86.rar

Link to comment

It still clicks but I just realized that with libmodplug it clicks too, although not as heavily (just play it with VLC, it uses libmodplug)

I guess it depends on the xm you're using, some were built for a specific player and others have trouble decoding it properly.

Just found two more small libraries, maybe they are worth a shot:

The latter also supports it, s3m, mod. While I havent tested if it's functional the code does look complete, just needs some tweeks to load from memory it seems.

Anyway, I got what I needed, chapter closed for me. Thanks again, guys :hug:

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...