Jump to content
  • Advertisement
Sign in to follow this  
jake_Ghost

Is this a good way to do sound?

This topic is 4828 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well I have finally got the point in my game where I want to put sound in. Before I make my sound class (I'm using FMOD by the way), I want to make sure what I plan on doing is the "right" or "best" way to do it. So here it goes... I plan on using two types of sound. Permanent and non-permanent sounds. Permanent sounds can only be loaded and unloaded through code like UnloadPermanent() or w/e. I plan on using permanent sounds as background/ambiant sound. Non-permanent would be like footsteps/weapon sounds,ect. So if I have a max sound limit of 32 the first few will most likely be permanent sounds. The rest will be loaded when needed since they are < 150kb each. Now comes the harder part I guess. How to load/play non-perm sounds. I will keep a count of how many "objects" are using the sound in my game. So that the number of objects using that sound can determine the priority of it. Assuming that there is are spaces open for more sounds, when I call the PlaySound() function, it will load the sound and increase that sounds usage count. When that sounds count == 0 then I was thinking of waiting a few seconds before unloading it, which could save time if I will be using it again shortly (eg. There running and then stop running for a second then start running again) and after that amount of time, unload the sound. If it tries to load/play a sound and there are no more slots left for some reason, then it will look for the slot with the least priority (lowest usage sound), unload it and load the new sound if its priority is greater than the one its overwriting. I was also thinking of dividing the sounds even furthur to help get the priority of a sound. I was thinking of Interface, Combat, Speech, and Effects. So combat would have the most priority, then effects (thunder, ect), speech the interface. I hope this is clear to understand. Please give me some feedback about my thought of how to do sound. Thanks, Jake

Share this post


Link to post
Share on other sites
Advertisement
Well, depending on the size of the sounds and the ammount of RAM available to you, it's probably worthwhile to have a system that can tell what sounds will be used in a level, and load all of them into RAM.

Then, when you're actually playing, the priority-based system (if you have a limited number of channels) is not a bad idea. Although rather than having permanent sounds and non-permanent sounds, just give each sound a priority. It may sound worse if an explosion is cut short than if an ambient sound is cut short.

I'd personally use a configuration file of some description to provide some base priorities to different sounds on a per-sound basis. You'd probably need some kind of tie-breaker system, unless your priorities were all unique.

Share this post


Link to post
Share on other sites
Sounds good, I guess I could spare maybe 1-5megs for sounds at runtime. And for those tie-breakers, I could just get its type (combat or w/e) so if it has the highest type priority, then it will choose that one since it will be load (like sword hitting a shield). Thx for the response :D

Jake

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!