Anyone has problems with SDL_mixer & mikmod?

Dear all,

I’m having a lot of problems with the playback of XM,MOD and others modules using SDL_mixer.
All of them are at end my program, I try to free the music resource and it fails on almost every free().

For example, the mloader.c of mikmod has this function:

static void ML_FreeEx(MODULE *mf)
{
UWORD t;
if(mf->songname) free(mf->songname);
if(mf->comment) free(mf->comment);
if(mf->modtype) free->modtype

well, the last line (free->modtype) fails ALWAYS that I try to free a module…

I know the MikMod code of sdl_mixer is very old version…

Anyone has the same problems?

Roberto Prieto
megastorm at mi.madritel.es
http://www.megastormsystems.com

Roberto,
have you loaded more than one music track? I did this with one of my games, where I loaded all of the the tracks at once, and then played them when needed, then tried to free them all at the end of the program, but it was a crash-ending every time.
My solution was to only load one music track at a time, when needed, and free it before the next was loaded. In this way, I avoided a crash in freeing music tracks.

I hope this helps,
-Dave----- Original Message -----
From: Roberto Prieto
To: sdl at libsdl.org
Sent: Saturday, October 01, 2005 1:22 PM
Subject: [SDL] Anyone has problems with SDL_mixer & mikmod?

Dear all,

I’m having a lot of problems with the playback of XM,MOD and others modules using SDL_mixer.
All of them are at end my program, I try to free the music resource and it fails on almost every free().

For example, the mloader.c of mikmod has this function:

static void ML_FreeEx(MODULE *mf)
{
UWORD t;
if(mf->songname) free(mf->songname);
if(mf->comment) free(mf->comment);
if(mf->modtype) free->modtype

well, the last line (free->modtype) fails ALWAYS that I try to free a module…

I know the MikMod code of sdl_mixer is very old version…

Anyone has the same problems?

Roberto Prieto
megastorm at mi.madritel.es
http://www.megastormsystems.com



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

Hello David,
yes, I have loaded more than one music track…
I had a lot of bugs when I free the music chunk… with debugger I saw that errors could be due to some kind of “interferences” between different music tracks (if I changed the music load order, I got different results or even, no errors!) but I would have to do more and more tests… thanks you, I have tried to load only one track and… like a miracle, anything works! so, sincerely, thanks you very much!

I had a music loader manager so I will extend it to only load on SDL_mixer one track at the same time, this “issue” will be completely hidden for the final programmer.

Anyway, Is this behaviour normal? I havent read anything about only load one music track at the same time… and also, I am a bit surprised because nobody has reported (as far as I know) this issue.

I will do more testing (using different compiler, read the internals of sdl_mixer when manage music tracks, etc.) to try to understand more this issue.

Any help, would be appreciated. Thanks in advance.
Cheers----- Original Message -----
From: David Olsen
To: A list for developers using the SDL library. (includesSDL-announce)
Sent: Sunday, October 02, 2005 5:56 PM
Subject: Re: [SDL] Anyone has problems with SDL_mixer & mikmod?

Roberto,
have you loaded more than one music track? I did this with one of my games, where I loaded all of the the tracks at once, and then played them when needed, then tried to free them all at the end of the program, but it was a crash-ending every time.
My solution was to only load one music track at a time, when needed, and free it before the next was loaded. In this way, I avoided a crash in freeing music tracks.

I hope this helps,
-Dave
----- Original Message -----
From: Roberto Prieto
To: sdl at libsdl.org
Sent: Saturday, October 01, 2005 1:22 PM
Subject: [SDL] Anyone has problems with SDL_mixer & mikmod?

Dear all,

I'm having a lot of problems with the playback of XM,MOD and others modules using SDL_mixer.
All of them are at end my program, I try to free the music resource and it fails on almost every free().

For example, the mloader.c of mikmod has this function:

static void ML_FreeEx(MODULE *mf)
{
UWORD t;
if(mf->songname) free(mf->songname);
if(mf->comment) free(mf->comment);
if(mf->modtype) free->modtype
....

well, the last line (free->modtype) fails ALWAYS that I try to free a module...

I know the MikMod code of sdl_mixer is very old version...

Anyone has the same problems?

Roberto Prieto
megastorm at mi.madritel.es
http://www.megastormsystems.com

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


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

yes, I have loaded more than one music track…
I had a lot of bugs when I free the music chunk… with debugger I saw
that errors could be due to some kind of “interferences” between
different music tracks (if I changed the music load order, I got
different results or even, no errors!) but I would have to do more and
more tests… thanks you, I have tried to load only one track and…
like a miracle, anything works! so, sincerely, thanks you very much!

Can someone post a small program that reproduces this issue?

–ryan.

yes, I have loaded more than one music track…
I had a lot of bugs when I free the music chunk… with debugger I saw that errors could be due to some kind of “interferences” between different music tracks (if I changed the music load order, I got different results or even, no errors!) but I would have to do more and more tests… thanks you, I have tried to load only one track and… like a miracle, anything works! so, sincerely, thanks you very much!

Anyway, Is this behaviour normal? I havent read anything about only load one music track at the same time… and also, I am a bit surprised because nobody has reported (as far as I know) this issue.

I will do more testing (using different compiler, read the internals of sdl_mixer when manage music tracks, etc.) to try to understand more this issue.

Any help, would be appreciated. Thanks in advance.
Cheers

Maybe this is related, but I’m not sure. I haven’t touched MikMod in
over a year but,I remember with MikMod, it was not designed to play
more than one file at a time. I ran into serious trouble when I tried
playing multiple tracker files through MikMod simultaneously (imagine
if I was using mod files for sound effects).

I think this would usually result in a crash. I think in Windows it
was most definitely a crash. In Linux, I vaguely remember tempo/speed
conflicts if not a crash. Looking into the MikMod source at the time,
I could see that the MikMod playback functions were not re-entrant. So
playing multiple tracker files simultaneously was a no-no. I think
this was a known bug at the time and the next major version of MikMod
had at least talked about fixing this, but I haven’t been following
it’s development. Maybe you can find out if there is a new version
that finally corrects this.

Anyway, I wouldn’t be terribly surprised if the MikMod loading
functions also suffer from the same problem. The code base just didn’t
look like it was written to deal with more than one file at a time.

A little off topic, but SDL_sound supports ModPlug as a possible
replacement for MikMod for its tracker decoder. ModPlug has given me
less problems in this area. Though unfortunately, I haven’t found
ModPlug as readily available for as many platforms and I can’t find
the source for it (my searches always bring up the wrong modplug).

-Eric> From: “Roberto Prieto”

Ryan, Im trying to compile a simple as I can program to reproduce this issue
but after a source code exploration of MikMod… and the replies from David
Olsen and E. Wing Im sure that SDL_mixer with MikMod can only handle one
module at the same time. So, it that is probe to be true, I think that could
be added some code to stop or to break the execution given an error instead
of allow it and provoke fatal errors when free your modules.

Anyway, let me compile that simple example…

E.Wing, thanks you very much! and of course, for Ryan too.

cheers> ----- Original Message -----

From: icculus@icculus.org (Ryan C. Gordon)
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, October 03, 2005 9:08 AM
Subject: Re: [SDL] Anyone has problems with SDL_mixer & mikmod?

yes, I have loaded more than one music track…
I had a lot of bugs when I free the music chunk… with debugger I saw
that errors could be due to some kind of “interferences” between
different music tracks (if I changed the music load order, I got
different results or even, no errors!) but I would have to do more and
more tests… thanks you, I have tried to load only one track and…
like a miracle, anything works! so, sincerely, thanks you very much!

Can someone post a small program that reproduces this issue?

–ryan.


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

Well, I have a simple program that crashes when it does Mix_FreeMusic()'s.
http://web.madritel.es/personales/roberto02/MixerPureMode.rar

cheers> ----- Original Message -----

From: dm2@mi.madritel.es (Roberto Prieto)
To: "A list for developers using the SDL library. (includesSDL-announce)"

Sent: Monday, October 03, 2005 10:24 PM
Subject: Re: [SDL] Anyone has problems with SDL_mixer & mikmod?

Ryan, Im trying to compile a simple as I can program to reproduce this
issue but after a source code exploration of MikMod… and the replies
from David Olsen and E. Wing Im sure that SDL_mixer with MikMod can only
handle one module at the same time. So, it that is probe to be true, I
think that could be added some code to stop or to break the execution
given an error instead of allow it and provoke fatal errors when free your
modules.

Anyway, let me compile that simple example…

E.Wing, thanks you very much! and of course, for Ryan too.

cheers

----- Original Message -----
From: “Ryan C. Gordon”
To: "A list for developers using the SDL library. (includes SDL-announce)"

Sent: Monday, October 03, 2005 9:08 AM
Subject: Re: [SDL] Anyone has problems with SDL_mixer & mikmod?

yes, I have loaded more than one music track…
I had a lot of bugs when I free the music chunk… with debugger I saw
that errors could be due to some kind of “interferences” between
different music tracks (if I changed the music load order, I got
different results or even, no errors!) but I would have to do more and
more tests… thanks you, I have tried to load only one track and…
like a miracle, anything works! so, sincerely, thanks you very much!

Can someone post a small program that reproduces this issue?

–ryan.


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


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