I just wanted to "warn" people that last night I got OpenAL working here inside FG. I have a couple comments.

1. I redid the lower level sound sample and sound manager interfaces a bit to clean things up and simplify things. I'm not sure it's worth going back and getting this new interface working with plib's sound system.

2. The plib sound system was set to play at 8000 hz no matter what the sample was recorded at. So a 22000 hz sample wouldn't play at the right pitch by default. We compensated in our sound config files for this by offsetting the pitch by 22000/8000 to get the sound back in the right range. However, that means that with OpenAL which handles this "correctly", some portions of our sound configs will need to get retweaked to make the pitch correct again. Most sounds are fine, it's just a few of them where there is this issue.

3. The maximum pitch factor that OpenAL allows is 2.0 ... we blow by that with some of our sound configs ... that's another thing that will need to be tweaked and looked at.

4. Some of the sounds and blending come out a bit different in OpenAL so I think all our aircraft designers will need to go through their sound configs once just to make sure everything sounds reasonable to them.

5. OpenAL can handle stereo sounds and 16 bit sounds so we should be much more flexible with the kinds of sounds we can handle. OpenAL has a loader for .wav format, but nothing else that I've seen.

6. Building our own sound samples in memory (i.e. calculating the wave pattern ourselves and writing to an array) works just fine with OpenAL.

7. The low level openal calls are wrapped up by something called "alut" which is kind of analogous to "glut" (OpenAL tries to mimic the OpenGL interface as closely as possible.) The OpenAL library is very sneaky and actually runs in a background thread, all the threading work is buried in the library where you can't see it. So something like the following will work correctly:

int main() {
   // initialize openal
   // create_sound_sample
   // play sound (looped)

   sleep( 100 );
   return 0;

You will get 100 seconds of looping sound ... that makes things a lot easier at the application level. You don't have to worry about how the sound stream is buffered or calling an update function every frame.

8. I haven't done anything with the spatial setup yet. We can worry about that at some later time when we have the basics squared away.

9. I want to do some more fiddling before I do any cvs commits, but I'm close to proposing that we switch over to OpenAL, so all you developers may want to head over to http://www.openal.org and get yourself setup to be able to build openal applications.

10. I expect that this change will cause some initial grief for some people and I apologize for that in advance, but I think the long term benefits will outweigh the short term hassles.



Curtis Olson http://www.flightgear.org/~curt HumanFIRST Program http://www.humanfirst.umn.edu/
FlightGear Project http://www.flightgear.org
Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d

Flightgear-devel mailing list

Reply via email to