Archived

This topic is now archived and is closed to further replies.

Coluna

Managing sounds in a engine (or game)

Recommended Posts

Hi; I''ve done some classes to wrap the DirectSound, and now i have a sound class. Let me say that im doing a FPS game (online or not). Every player or npc has some sounds, like footsteps, some talks. Each gun emits sounds when it shots, and the bullets emit sound when collide with something...as u can see, there is a lot of sounds at the same time, but some (or lot of them) are not in the auditive (?) region of the current listener. So, them could be stopped when it comes out of range, and played again when in range, to free some sound channels. Currently i have one linked list (slow, ok, just for testing) for active sounds,and one for the sounds that r stopped. So each frame (could be done less times, eg once for 2 or more frames) i check if any active sound is out of range, and if yes, i pause it and insert it into the stopped list, and do the same thing to the stop list (if r in range, unpause it). But i think its not an ideal solution, but i couldnt find any discussion, tutorial or anything else about it....Any suggestion? Thanx

Share this post


Link to post
Share on other sites
If you have the memory and buffers, load all sounds. If not, DuplcateBuffers as you need new ones. That should be fine. Remember to performance check. With a linked list you might lose more performance that way than you would by lumping more into the sound card. A lot depends on the quantity of sounds. Most sounds cards have a lot of memory nowadays.

Mark
Ever wanted to command a starship?
http://www.lostinflatspace.com

Share this post


Link to post
Share on other sites