SDL or OpenAL?

Right now I am “evaluating” different options for stereo panning in my
game:

  • SDL using it’s “native” mixer functions
  • SDL using the additional SLD_mixer
  • OpenAL

As I understand, the “native” mixer from SDL is quite low-level and I
would have to write a lot of my own (own creation of threads, keeping
track of already playing samples etc.), right?

This is already handled by the SDL_mixer, but it doesn’t do stereo
panning yet, right? So I would have to implement this as well…

Or I could use OpenAL, but it seems to me that it’s not very usable yet
(yesterdays snapshot only produced “garbling” sound on my
soundcard/linux box).

Basically I am looking for a way to mix samples, where I could control
the panning of each single channel at all time (given e.g. the position
of some object) - support for additional background music would be
great, but not necessary at first… (I think the later is not
implemented in OpenAL yet, right?)

And I guess I wouldn’t be able to use both SDL_mixer (for background
music) and OpenAL (for stereo panning) at the same time (since they
would try to access the soundcard at the same time)?

Or does anyone else know of any other possibility (besides reinventing
the wheel) to mix audio with stereo panning?

Any comments/experience?

Thanks, Oliver

As I understand, the “native” mixer from SDL is quite low-level and I
would have to write a lot of my own (own creation of threads, keeping
track of already playing samples etc.), right?

as I wrote earlier, don’t use SDL_MixAudio. Writing your own is not
difficult however (I would not expect someone from ethz to have the
slightest problem doing it :-). You don’t really need to use threads at all

I think OpenAL can simulate background music by simply putting a listener
and, at the same position, a source that play the background music, in an
empty environment.
Am I wrong?

Till Oliver Knoll a ?crit:> Right now I am “evaluating” different options for stereo panning in my

game:

  • SDL using it’s “native” mixer functions
  • SDL using the additional SLD_mixer
  • OpenAL

As I understand, the “native” mixer from SDL is quite low-level and I
would have to write a lot of my own (own creation of threads, keeping
track of already playing samples etc.), right?

This is already handled by the SDL_mixer, but it doesn’t do stereo
panning yet, right? So I would have to implement this as well…

Or I could use OpenAL, but it seems to me that it’s not very usable yet
(yesterdays snapshot only produced “garbling” sound on my
soundcard/linux box).

Basically I am looking for a way to mix samples, where I could control
the panning of each single channel at all time (given e.g. the position
of some object) - support for additional background music would be
great, but not necessary at first… (I think the later is not
implemented in OpenAL yet, right?)

And I guess I wouldn’t be able to use both SDL_mixer (for background
music) and OpenAL (for stereo panning) at the same time (since they
would try to access the soundcard at the same time)?

Or does anyone else know of any other possibility (besides reinventing
the wheel) to mix audio with stereo panning?

Any comments/experience?

Thanks, Oliver


Matthieu DUFOURNEAUD
49, boulevard Normandie Niemen
42100 Saint-Etienne
FRANCE
Tel.: +33 (0)4 77 34 15 24
Email: matthieu.dufourneaud at fnac.net

Maitrise d’Informatique
Faculte des Sciences et Techniques de Saint-Etienne

“Till Oliver Knoll” wrote

This is already handled by the SDL_mixer, but it doesn’t do stereo
panning yet, right? So I would have to implement this as well…

not too long ago Andreas “glton” Umbach submitted an excellent
little patch that added stereo panning support into SDL. it was
a nice little change (but did need to alter a couple deep SDL
stuctures). i would have loved to see it appear in the 1.2
branch, but alas, i fear it was a little too late :[

anyways, you should be able to find it in the dreaded mail
list archive. unfortunately it means you’ll need to ship
your binaries with your own custom SDL library :[

Mattias Engdeg?rd wrote:

as I wrote earlier, don’t use SDL_MixAudio. Writing your own is not
difficult however (I would not expect someone from ethz to have the
slightest problem doing it :-). You don’t really need to use threads at all

Off course, the fourth possibility d) would be to write my own mixer,
but I am not keen on reinventing the wheel :wink: What I would like to have
though is an API where my application can just say “playMyMegaBlastNow
(megaBlastSample)” which would return immediately, and then the
application wouldn’t bother anymore about this sound (until it would
like to stop it, alter it’s panning or whatever) - that’s why I came up
with threads…

Are there any plans to implement such a sound mixer API into a future
version of SDL, such as SDL 2.0? Or will the SLD_mixer library extended
to support stereo panning?

Matthieu DUFOURNEAUD wrote:

I think OpenAL can simulate background music by simply putting a listener
and, at the same position, a source that play the background music, in an
empty environment.
Am I wrong?

I guess not. I’ve seen some example programs which supposedly load mp3
files, but they didn’t work for me, since some function (or some
extension or whatever) was reported to be missing. And then there’s a
"utility library" (like the glut library), but which isn’t implemented
yet, I think it would be responsible for loading song files…

Or does anyone know if I can already play mp3 files or *.xm files
(modules) with OpenAL? (Again, besides implementing my own mp3 player
for OpenAL :wink:

Cheers, Oliver