need help putting it all together (sdl_sound,sdl_mixer,physfs)

Eric Wing ewing2121 at
Mon Dec 2 09:03:10 EST 2002

Hello, can anybody help me with the following

I am working on a small game and would like to have
music, sound effects, and speech in it. Furthermore, I
am also very interested in using PhysicsFS because I
have lots of little files and packing them makes a lot
of sense.

I was going to use SDL_Mixer to do all my sound, but I
have discovered that it can't do everything I need it
to do. My music and speech files are kind of large, so
I would like to use MP3 or OGG formats. However, with
SDL_Mixer, it looks like only the dedicated MUSIC
channel can decode these formats, and you can only
play one file at a time. Furthermore, there is no
SDL_mixer function to allow loading a MUSIC file
through RWops (which I think I need if I want to use

So I've been reading about SDL_Sound and I've read
that you can get the two to work together. However, I
haven't been able to get them to work together in a
useful way.

First, FYI, I think there is a bug with the Init code
and MikMod. If I initialize both SDL_Sound and
SDL_Mixer (with Sound_Init() and Mix_OpenAudio(...)),
my program hangs. I think it gets stuck in an infinite
loop. If I interrupt the process with a debugger, I am
left inside "mloader" which seems to be a park of

void _mm_registerloader(MLOADER* lrd)
    MLOADER *cruise=firstloader;
    if(cruise) {
stuckhere->    while(cruise->next) cruise =
    } else 

It doesn't matter which one I initialize first. Once I
hit the second initialization call, I get stuck.

I am running Debian Woody (stable) and have SDL_Sound
1.0. I tried it with the Deb packaged SDL_Mixer 1.2.1
and the current cvs version 1.2.5. I recompiled
SDL_mixer 1.2.5 without Mikmod support and the problem
went away.

Anyway, after I removed Mikmod, I was able to get a
little further. Then I tried the following sequence:

sdl_sound_sample = Sound_NewSample(...);
sound =
Mix_PlayChannel(-1, sound, 0);

I tried several different types of files. Most of my
files played something recognizable, but they played
at the wrong speed. I was wondering how I can fix
this. I also had some low quality WAV files which were

But also, the DecodeAll option was taking a very long
time to run on my MP3 files, and I presume it's also
taking a lot of memory. I doubt I will be able to use
this function with the number of speech files I have.
Is there a way I can do this so I don't have to decode
the whole thing, or am I totally out of luck? I see
the Sound_Decode() function, but I don't know how I
can stream it to SDL_Mixer.

I would appreciate any ideas or solutions to these
problems. Also, if SDL_Sound/SDL_Mixer/PhysFS won't
work, is there another (LGPL compatible) solution,
perhaps SDL_Sound/OpenAL/PhysFS? (and what would the
interfaces look like)?

Thank you,

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

More information about the sdlsound mailing list