Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MOD/Tracker music! SDL does not loop properly
#1
It would be great if this forum had a  "Retro game development" sub forum since that's what we'll be doing with Tilengine!  That's where I'd put this post if it existed.

Back on topic; Herein, when I say MOD files, I mean all tracker formats - MOD, S3M, IT, XM, etc.

SDL_Mixer (and IDEs that use SDL, such as Love2D) can "play" MOD files, yes - and I guess apparently we should count our blessings that anyone seems to care about implementing such an old (super compact and dynamic!) format... but they do not loop properly, not one bit.  The song reaches the end... there is a huge half-second pause while the sound system takes a breath... and then the song restarts again.  Always from the very beginning.  Loop points are ignored, and looping is NOT seamless!!  This is unacceptable!  This is like... the whole point MOD files were invented; to be dynamic, and played seamlessly in the background of games.

Looking into the issue in SDL_Mixer, it seems it uses MikMod and ModPlug under the hood, and it deliberately ignores the looping features they provide.  I find this incredibly ignorant.   The only use case this would benefit is media players - that's it.  That is an extremely limited use case.  What about... you know, games?  Why not provide an option to switch seamless looping on or off?  From what I can read, the author of SDL_Mixer seems completely oblivious to what this means.  The only comment I could find him responding to someone asking about this, is asking them why they couldn't just use the built in looping... man.

I found this thread giving two different methods to enable the settings of MikMod and ModPlug in SDL_Mixer to allow seamless looping, but neither approach made a difference.  And the most recent thread on the issue I could find, contained a post of someone saying that none of the tricks involving overriding the ModPlug settings work anymore in SDL_Mixer.

I hear that the MOD looping in Unity is seamless, to a fault - apparently it can't be ignored (fine by me!) and Unity uses a stripped down version of FMOD.  I haven't had a chance to test it in Unity but I am going to try using FMOD for my sound library for Tilengine, instead of SDL_Mixer.  Looking at the API documentation, there are commands for individual channel volumes in MOD files (which is what you could use to cross between different sound tracks without skipping a beat, a la Banjo-Kazooie), and I wager if it has this kind of attention to detail for MOD file support, then of course looping should work!

Fingers crossed!

(Note: I'm currently using C++.  A quick search shows that FMOD does have a C# wrapper but so far it seems like C++ is the most well worn path with these things, so I'm sticking to it for now.)
Reply
#2
Success! FMOD plays looped MOD files correctly.  Hooray.  Geez.

If anyone wants any help, just let me know.  But it's just the usual stuff with setting up C++ libraries and refering to FMOD's documentation to start the sound system and kick off a sound.

FMOD can even play without looping, it has a built in feature to disable the loop point and calculate the length of the song by pre-calculating it when it loads.  That's how fully fleshed out FMOD is.
Reply
#3
Hi! I've been out and offline a few days. I'm glad you have MOD tracks playing right now! SDL_Mixer is a straightforward library that requires few steps to get things done, just a bit of initialisation. The most tricky part may be having the collection of required dll's located in searchable paths. Easy in Linux installing the suitable packages, but custom management under Windows.

I liked your suggestion about game development topics, so I've moved this and some other thread to the new category. Thanks!
Reply
#4
I read somewhere that the creator of SDL_Mixer said it was only meant to be very simplistic.  But FMOD gets initialised and plays sounds in just as many lines of code! It's just more venerable... I think perhaps SDL_Mixer was invented as a free open source solution when FMOD used to be licenced. But now it's free if you earn less than 500k for your game or something, similar to Unity.
Reply
#5
FMOD is the behemot of professional audio engines. It has builds for every gaming platform and is the core audio component of many high-profile game engines: UE3, UE4, Unity, Source, CryEngine, Torque... If you go pro, you go FMOD, directly or indirectly.

I tinkered with it back in the early 2000s, when it was in release 3.75 (prior to FMOD EX, a discontinued product itself). I guess it's a very different beast nowadays.

For hobbyst/amateur/retro projects I'll stay with SDL_Mixer, because it's free, contained inside the SDL family, and simple. I don't need all that 3D positional audio, fancy FX and reltime multitrack mixing to make a super mario world clone Smile

But it's up to anyone to choose its own tools, of course!
Reply
#6
The only thing that bugs me about FMOD is that every time I've looked at it over the past decade, it seems to have had some major overhaul. FMOD 3 -> FMOD 4, 4 to FmodEx, and last time I looked it was different again. And OpenAL has remained OpenAL. Clunky, but it gets the job done. But I'm obviously not using it more than an interface to chuck waveforms at -- I've not decided on the music for my current project, but it may involve some tracking stuff, so I'll have to see how that pans out.
Reply
#7
That's true, they keep launching totally new products with every major release. That may not be a concern for the professional studios with big budgets they target too. I think FMOD is an excellent product, but for hobbyist/amateur projects is totally overkill. And you're using a proprietary product with licensing costs, in case you want to sell your game.

I always try to use the simplest library/component that gets the job done. OpenAL is very low level and provides basic audio streams, you have to build something in top of it for more complex features.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)