Mix_PlayMusic doesn't loop for mod files?

OK, this is driving me nuts. I built SDL_Mixer against mikmod and played a .IT
file in it. At the end of the file is a B05 opcode, which means “loop music
beginning from Sequence pattern 05”. It ignored this and looped back to the
start of the file. I figured it might be a glitch in mikmod, so I built
SDL_Mixer against libmodplug instead, but I got the same result. Looping to the
start of the song instead of the designated pattern.

They can’t both be broken. This file was created in ModPlug, so it should play
right from libmodplug at least. So I have to wonder, is there something in
SDL_Mixer that’s somehow interfering with looping for mod music? If so, how do
I disable it? Looping is the main reason I’m using mod format; if you’re
writing a game it’s essential to have looping working right.

With MikMod you can try modifying the underlying MODULE structure:

#include <mikmod.h>

MODULE mod;

Mix_PlayMusic(music, 0); /
Disable SDL looping */
mod = Player_GetModule();
mod->loop = 1;

(I don’t know much about ModPlug - you might be able to do something
similar there). Basically you’d be skipping SDL_Mixer’s looping (since
it doesn’t really know/care about internal MOD looping details), and
use MikMod’s looping directly (which does know/care).

-MikeOn Sun, Apr 10, 2011 at 4:41 PM, Mason Wheeler wrote:

OK, this is driving me nuts. I built SDL_Mixer against mikmod and played a .IT
file in it. ?At the end of the file is a B05 opcode, which means “loop music
beginning from Sequence pattern 05”. ?It ignored this and looped back to the
start of the file. ?I figured it might be a glitch in mikmod, so I built
SDL_Mixer against libmodplug instead, but I got the same result. ?Looping to the
start of the song instead of the designated pattern.

They can’t both be broken. ?This file was created in ModPlug, so it should play
right from libmodplug at least. ?So I have to wonder, is there something in
SDL_Mixer that’s somehow interfering with looping for mod music? ?If so, how do
I disable it? ?Looping is the main reason I’m using mod format; if you’re
writing a game it’s essential to have looping working right.