Hi, I was wondering if anyone else has the same problem I do, or it is
something I’m doing wrong. On my action game I have, for each stage, a
regular stage song, a boss rush and a stage clear song. As expected, the
boss is part of the stage, so when the player gets near the boss, the
music changes. When the boss is defeated, the stage clear song plays and
everyone is happy. Well, not quite.
I'm using .it files (MOD) for the music and if I try to load the three
musics at the same time time in memory, using three Mix_Music pointers,
the game will crash when unloading the musics. It does not happen on all
combinations, which is what puzzles me, some musics will unload just
fine when loaded in memory with other musics, but for most of them,
having more than one music in memory at the same time is a prelude to
doomsday.
I known that the bug is not somewhere in the game logic, I changed the
game to unload the current music and load the new music “on the fly” and
it works fine. No crash, no matter which music was played during the
stage. That is good when using a fast hard disk on a desktop, but when
playing the game from a CD or on a notebook, this is just awful.
I thought a very simple solution, which was to load the .it data in
memory and use SDL_Rwops to read the music from there, which would be
almost instantaneous and would solve my problem. Problem is that
SDL_Mixer does not support SDL_Rwops for music, just for samples. Or is
it an undocumented feature?
I know, in the end I can use ogg files for my music as well and handle
myself the “music playing as a sample”, but everything is so nicely
organized on (small) .it files that it seems a waste to include another
lib just to be able to play (larger) ogg files.
Best Regards,
Paulo V W Radtke