Sign in to follow this  

Many sources in OpenAL

This topic is 3039 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

I've started to work with OpenAL and did the most basic setup och device and context. It now seems that the number of sources are limited to 32. In my application this is a problem since nearly all objects (mostly vehicles) in the world has a sound attached to them. And when a lot of other sounds are generated the sources will run out and thus I need some way of handling this. I have read something about having a pool of sources but what strategies are to be applied to determine what sources should be allowed to play. When a new sound is generated and all sources are in use one og them need to be stopped and used for the new sound. To conclude my question a little, what is the most common way of handling this limitation of 32 sources?

Share this post


Link to post
Share on other sites
First ask yourself if you really _need_ more than 32 sources, if it's really worth it. Sound output will be hardly meaningful if there are lots and lots of sounds and the user isn't able to distinguish them. In a scenery like yours, many engines will probably be some rumble-rumble and you could easily play just the sounds near to the listener without much (or any) impact on the result.

To decide which source to stop, you can try some kind of priority system, where you take out the less important source at that time. What is "important" may vary, you could choose the one that has played longer, the most distant/lower volume sound source or even kick one out randomly :) Probably background music shouldn't be included in this 'swap list', most people get mad when the music stops.

Another option is mixing the sounds yourself before feeding the data to OpenAL. You could also try OpenAL soft, which seems to have a source limit of 256.

Share this post


Link to post
Share on other sites
Basically, you need to allocate the sources based on some priority metric,for example volume (or, since you have positional sources-> distance) or some artist-set metric (gameplay-relevant sounds should always take priority over atmosphere-only sounds) etc.

You may want to make sure, that any sound that is interrupted by a higher priority sound is only interrupted at the next zero-crossing to prevent clicking.

Share this post


Link to post
Share on other sites
A limit of 256 would be very much sufficient. Is it a large overhead using this instead of the default which I guess is hardware mixing?

I was also thinking about some kind of priority based on volume, distance and other properties.

Share this post


Link to post
Share on other sites
Quote:
Is it a large overhead using this instead of the default which I guess is hardware mixing?
The 'default' is Creative's implementation, which will fall back to a software mixer if the system doesn't meet the requirements for a hardware approach.

Your best bet is to try it out :)

Share this post


Link to post
Share on other sites

This topic is 3039 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this