[coco-devel] Re: Copter-Commander AL query
Brought to you by:
svref
From: David M. <dm-...@bo...> - 2001-03-13 02:28:43
|
Garin Hiebert <ga...@tu...> wrote: > David: > > I took a look at Copter-Commander today, and have a few comments regarding > your request for help on problems with the OpenAL code. > > The audio seems to be running better on my machine than on some that you > mention -- it's a 550MHz Athlon with a Geforce 2 for video and an SB Live for > audio. I get 10-12 fps continuously when running the game. Running either > esd or OpenAL audio, the game sounds pretty much the same, although it > appears that you're playing around with the audio positioning differently > with AL -- I didn't do enough testing to make sure on that. > > When it comes to performance of the AL audio, one thing comes to mind which > may help out. I note that whenever any audio is played, an un-used source is > being found, then the buffer for that effect is attached, then the source > played. For instance, when the machine gun on a copter is being shot, a new > source is being used for each shot from the gun, which is requiring a lot of > searching through the available sources, attaching of buffers, and "play" > calls. > > A couple of ways come to mind for reducing the number of AL calls. The > simplest -- for this game -- would be to allocate one source for each sound > effect you might want to play. It seems that you probably have few enough > effects that this would work. Then there wouldn't be any searching for > sources or buffer attachment required when you want to play an effect. > > If there aren't enough sources available or if you just want a more flexible > audio engine, then you probably want to at least re-work the engine so that > it will use single sources for as long as possible rather than continuously > churning through new sources while repeating a single effect. Along these > lines, I'd be tempted to reserve some sources for popular effects such as the > weapons, and then do more sophisticated management of sources for > intermittent effects such as people yelling. I tried your suggestion. It works very well! I keep a couple of dedicated "bullet", "rocket hit", and "bomb hit" sources, eliminating the alSourcei(AL_BUFFER) for these frequent sounds. That completely eliminates the problem. I added a "project thank you" for you here: http://www.speakeasy.org/~morse/copter-commander/thanks.html |