Archived

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

Waverider

One possible sound system design - insight please?

Recommended Posts

In one of my older demos, I developed a generalized set of sound functions that would accomodate sounds that moved with objects, doppler effects, etc. One of the functionalities was to set the maximum number of sounds playing so that the sound system doesn't become overloaded and affect CPU cycles. To help implement this effect, whenever a request to play a new sound comes in, the sound's priority and volume would be used to determine if it interrupts another sound that is already playing. This of course only happens if the maximum number of sounds is already playing. The system also used a frame-based queueing. This means when a request to play a sound comes in, the sound doesn't play immediately. It will register itself to play directly after the current frame is rendered. This is partly to time the sounds better with the animations, but also, if say 1000 sounds want to play but only 8 are allowed, there won't be a lot of starting and stopping of sounds to filter out which 8 sounds will be allowed to play. This, I presume, reduces static and flicker in the sound system. This was all done with DirectX 5. I'd like to redo it all eventually with DirectX 9. Does this design sound feasible, or are there more accepted/professional ways of handling it? Thanks for any insight. [edited by - Waverider on May 5, 2003 2:52:11 PM]

Share this post


Link to post
Share on other sites
I''d personally use more weighting functions. For example in a 3d environment you can weight the priority of a sound by things like proximity of emitter to ear, amount of geometry blocking sound etc. Then just pick the top 8(or less).

I use something very similar to this to work out which objects get affected by dynamic lights, which also has a limit of 8 per object. The game then of course can control the number that will -actually- be in effect with a software function(so the user can configure it).



Chris Brodie
http:\\fourth.flipcode.com

Share this post


Link to post
Share on other sites
When I get into 3D sound effects, I'm sure I'll see the benefits to the additional criteria.

Does it seem feasible that I don't actually commit the sounds to the player until I've gone through all the sounds that want to play first and picked the best candidates? I imagine this helps avoid erratic behavior on cards that couldn't handle a lot of stops and starts in a short period of time. Of course, I have to be careful not to interrupt currently playing sounds just to start them up again (particularly true for sounds that play repeatedly, like ambiant sounds that loop)

I know that a lot of newer hardware could probably handle it, but if I can code it so that there is little performance loss on the newer cards, and the older cards actually run better for it, why not do it?


[edited by - Waverider on May 7, 2003 11:37:00 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by Waverider
When I get into 3D sound effects, I''m sure I''ll see the benefits to the additional criteria.

Does it seem feasible that I don''t actually commit the sounds to the player until I''ve gone through all the sounds that want to play first and picked the best candidates? I imagine this helps avoid erratic behavior on cards that couldn''t handle a lot of stops and starts in a short period of time. Of course, I have to be careful not to interrupt currently playing sounds just to start them up again (particularly true for sounds that play repeatedly, like ambiant sounds that loop)

I know that a lot of newer hardware could probably handle it, but if I can code it so that there is little performance loss on the newer cards, and the older cards actually run better for it, why not do it?


[edited by - Waverider on May 7, 2003 11:37:00 AM]


wow, from what you have it seems good, you may not need it though. I recently read about Direct sound and it actually mixes the new sound buffer with the current main sound buffer so really your system should be able to play unlimited sounds at a time. If you are using synthesizers then you would probably have to limit the sounds generation though because of cpu.

Share this post


Link to post
Share on other sites