03-07-2007, 07:03 AM,
|
|
stenyak
Junior Member
|
Posts: 44
Threads: 1
Joined: Dec 2006
|
|
I thought SDL didn't feature 3d sound...
|
|
03-07-2007, 07:09 PM,
|
|
stenyak
Junior Member
|
Posts: 44
Threads: 1
Joined: Dec 2006
|
|
Doesn't that sound like to coding you own software graphics renderer (instead of using d3d or ogl)?
What kind of control do you need over the sounds that openal does not allow? (i haven't used any of the two very much, and i'm interested in knowing some more)
|
|
03-07-2007, 11:09 PM,
|
|
joevenzon
Administrator
|
Posts: 2,679
Threads: 52
Joined: Jun 2005
|
|
So, the basic SDL audio (just part of libSDL) lets you feed data to the soundcard. SDL_mixer is another lib that will do things like let you load some WAV files and play them and the library will do sound mixing and feed data to the soundcard itself. We currently use no SDL-related sound, only OpenAL.
OpenAL is supposed to be like OpenGL, but for sound. It lets you load WAV files, adjust gains and pitch, and have them associated with 3D positions. The latter allows you to have positional sound, sound that fades away, and doppler effects. On Windows, OpenAL uses DirectSound to provide hardware accelerated sound.
The problems with OpenAL are numerous. For example:
* It doesn't manage your sources for you, so you have to manually activate and deactivate sources based on what is most likely to be audible if you have a lot of sources. We don't currently do this in VDrift, so there are a bunch of bugs related to running out of sources.
* The documentation is poor.
* On linux, it falls back to software sound mixing, which 1) sounds terrible and 2) has clicking artifacts for looped sounds
* Pitch adjustments are only allowed within a narrow range (no more than 2.0 pitch adjustment factor) and it sounds terrible with the software mixing.
* From my experience with gaming on Windows, hardware sound support is pretty buggy, and leads to all kinds of odd problems (sound unexpectedly go mute, get stuck looping, or in some cases using hardware sound causes the framerate to stutter whenever a sound is played).
In another project, I wrote a sound engine on top of the libSDL sound functions (which just let you feed data to the sound card manually) in about a day. This engine lets you load WAV files, create sources with positions, and play them. It supports an arbitrary number of sources with automatic activation/deactivation based on what's audible, correct looping without clicks or artifacts, 3D sound positioning, and distance attenuation. It sounds good and runs fast (although I haven't tested it to the extreme yet).
It'd be easy for me to port the above to VDrift. All I need to add is support for 1) pitch adjustment and 2) doppler effects. It'd probably take another day or so.
If you were around when we used to use FMOD, it'll end up sounding like that again (nice and smooth).
|
|
03-08-2007, 11:25 AM,
|
|
stenyak
Junior Member
|
Posts: 44
Threads: 1
Joined: Dec 2006
|
|
Wow, i didn't know openal was that problematic! ...and that it was that easy to fix it? Personally i would go for openal (that's what i was planning to do before i read that post, now i'm not sure), but if you code a new sound library and you happen to make it usable by more projects (which would be nice, since there apparently are no good open source sound libs?), that would change things.
|
|
|