SDL_mixer and implicit looping of module music files

Hello,

A while ago (2001/10/18 to be precise), SDL_mixer was changed to
ignore the implicit looping of modules. The diff is at:

http://www.libsdl.org/cgi/cvsweb.cgi/SDL_mixer/music.c.diff?r1=1.31&r2=1.32

While it is probably better that way (this is arguable) for most
people (it was changed a long time ago and nobody complained), it
breaks the music in one of my games. Even though I think that implicit
looping stuff should stay off by default, I’d like a way to turn it
on…

I was about to suggest to add a new function (which would be trivial
to implement)
to do just that but then I thought Sam probably wouldn’t accept that
since it would bloat the API…

What about adding a single function to tweak several playback
parameters like that in module (and possibily other types) files?
These parameters are currently hard-coded. What I have in mind is a
function taking two parameters, the first one being an id (probably a
DEFINEd constant) of the parameter to change and the second would be
the actual value of that parameter. Probably something like that:

void Mix_SetPlaybackParameter(int paramid, int value);

So what do you people think (especially Sam)? Anybody sees another way
to overcome my problem?

-Ga?tan.

Hello,

A while ago (2001/10/18 to be precise), SDL_mixer was changed to
ignore the implicit looping of modules. The diff is at:

http://www.libsdl.org/cgi/cvsweb.cgi/SDL_mixer/music.c.diff?r1=1.31&r2=1.32

While it is probably better that way (this is arguable) for most
people (it was changed a long time ago and nobody complained), it
breaks the music in one of my games. Even though I think that implicit
looping stuff should stay off by default, I’d like a way to turn it
on…

Any reason you can’t just explicitly loop the files?

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

While it is probably better that way (this is arguable) for most
people (it was changed a long time ago and nobody complained), it
breaks the music in one of my games. Even though I think that implicit
looping stuff should stay off by default, I’d like a way to turn it
on…

Any reason you can’t just explicitly loop the files?

Of course, there is (otherwise I wouldn’t have asked for it in the
first place)… The modules I use don’t loop the entire song but only
some patterns. In other words, the songs I use are made out of an
introduction part (which is not repeated) followed by a main part
which is repeated forever.

I must admit there is a workaround though: I could manually store
somewhere (outside the module file itself) the pattern/position it
should jump to when the song ends. Then I could just jump to that
pattern within the “song end callback”. But this method would be quite
a pain and is quite ugly since the information is already in the
module file.

-Gaetan.On Thu, 23 Dec 2004 16:59:59 -0800, Sam Lantinga wrote:

Maybe it will be clearer with this information copy-pasted from
Mikmod’s documentation:

BOOL wrap
If nonzero, module wraps to its restart position when it is
finished, to play continuously. Default value is zero (play only
once).

BOOL loop
If nonzero, all in-module loops are processed; otherwise, backward
loops which decrease the current position are not processed (i.e. only
forward loops, and backward loops in the same pattern, are processed).
This ensures that the module never loops endlessly. The default value
is 1 (all loops are processed).

and this is from SDL_mixer’s code:

music->data.module->wrap = 0;
music->data.module->loop = 0;

What I don’t like is the loop = 0 (note it is not the default value in
mikmod) and that there is no way to change it, the wrap = 0 is fine
with me.

-Gaetan.On Fri, 24 Dec 2004 15:41:36 +0100, Gaetan de Menten wrote:

On Thu, 23 Dec 2004 16:59:59 -0800, Sam Lantinga wrote:

While it is probably better that way (this is arguable) for most
people (it was changed a long time ago and nobody complained), it
breaks the music in one of my games. Even though I think that implicit
looping stuff should stay off by default, I’d like a way to turn it
on…

Any reason you can’t just explicitly loop the files?

Of course, there is (otherwise I wouldn’t have asked for it in the
first place)… The modules I use don’t loop the entire song but only
some patterns. In other words, the songs I use are made out of an
introduction part (which is not repeated) followed by a main part
which is repeated forever.

I must admit there is a workaround though: I could manually store
somewhere (outside the module file itself) the pattern/position it
should jump to when the song ends. Then I could just jump to that
pattern within the “song end callback”. But this method would be quite
a pain and is quite ugly since the information is already in the
module file.

Quoth Gaetan de Menten , on 2004-12-24 15:41:36 +0100:

Of course, there is (otherwise I wouldn’t have asked for it in the
first place)… The modules I use don’t loop the entire song but only
some patterns. In other words, the songs I use are made out of an
introduction part (which is not repeated) followed by a main part
which is repeated forever.

Note that if you can edit the module, most module formats offer a
"jump to song position" command. Create an extra pattern that just
has the restart jump and put that at the end of the song sequence;
usually this will cause the module to jump back to the desired restart
point zero ticks after the end of the last pattern, which seems to be
what you want.

If you can’t edit the module, of course, this doesn’t work.

—> Drake Wilson

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20041224/63976575/attachment.pgp

Hi there.

I think it is a good idea (since it would be written
to be something like a state machine). If well
written, it would be amazing.
You can code default values, and a function that
would change it util the unloading of the module.
I think it is ok, since the default values are the
same of the ‘normal’ values, it would keep
retrocompatibility.

— Gaetan de Menten
escreveu:

Hello,

A while ago (2001/10/18 to be precise), SDL_mixer
was changed to
ignore the implicit looping of modules. The diff is
at:

http://www.libsdl.org/cgi/cvsweb.cgi/SDL_mixer/music.c.diff?r1=1.31&r2=1.32>

While it is probably better that way (this is
arguable) for most
people (it was changed a long time ago and nobody
complained), it
breaks the music in one of my games. Even though I
think that implicit
looping stuff should stay off by default, I’d like a
way to turn it
on…

I was about to suggest to add a new function (which
would be trivial
to implement)
to do just that but then I thought Sam probably
wouldn’t accept that
since it would bloat the API…

What about adding a single function to tweak several
playback
parameters like that in module (and possibily other
types) files?
These parameters are currently hard-coded. What I
have in mind is a
function taking two parameters, the first one being
an id (probably a
DEFINEd constant) of the parameter to change and the
second would be
the actual value of that parameter. Probably
something like that:

void Mix_SetPlaybackParameter(int paramid, int
value);

So what do you people think (especially Sam)?
Anybody sees another way
to overcome my problem?

-Ga?tan.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Converse com seus amigos em tempo real com o Yahoo! Messenger