Jump to content
  • Advertisement
Sign in to follow this  
codeman83

OpenAL cannot generate over 32 sources on newer computer/labtops.

This topic is 4861 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 am using OpenAL for my game project. The problem im having with it is when I generate sources it gives me an error and connot generate them all. The funny thing is on my older labtop I tested generating up to 300 sources and it worked fine. With newer labtops and computers for some reason I can only generate up to 32 sources and then anything above that it will give me an error and not generate them. Is there anything i can do to get around this on newer computers. Here is some source code of how I generate the sources. I am doing 33 of them to show that after 32 on newer computers it will not generate the sources. ALuint Sources[33]; // Generate the sources. alGenSources(33, Sources); if((error = alGetError()) != AL_NO_ERROR) return false; PLEASE SOMEBODY HELP MY GAME PROJECT IS DUE TUESDAY.

Share this post


Link to post
Share on other sites
Advertisement
If the hardware can only generate 32 sources, then unfortunaltly you have to live with it, as that is all it is capable of.

I doesnt have to be a problem, though, depending on what you are using the sources for. I would be very surprised, in a game situation, if you used more than 32 sources at any given time anyway!

If you need more than 32, then the only solution is to prioritise the samples requesting a source. That way, improtant sound will always play (even if it means booting a lower priority ssample of a source and using it itself), while lesser sounds may or maynot.

Spree

Share this post


Link to post
Share on other sites
Few things -

1. Please don't do what you did in your last line, it is really obnoxious and people will be less inclined to help you. (In the event you return for more help in the future [smile])

2. Now, as for OpenAL it depends on the soundcard. Newer computers can and do get more sources than 32. I know that they range from (0-64]. My computer can do 32, but some can only do 16.

You do not need 32+ sources for a game! You only need at most 16, of which you will only use a maximum of 8 at a time. A source represents the audio itnerface that OpenAL will output sound. If you use anymore than what Iv'e said, think about it - 32 sources playing at once?! I hihgly doubt your laptop could generate 300+ sources, either there was a bug or the errors were not checked properly [wink]

Ideally you will need to just allocate a set number, such as 16 - for maximum compatability on all computers. From there you will need to effecitvely manage the sources. Note that you do not need 1 source for each sound! Think of a source as a microphone. You will, however, need 1 buffer per sound. When you want to play a sound, you will send the buffer to an open source.

So wrapping up this is what you need to do.

1. Generate about 16 sources in an array.
2. Create an array of bool values to track which one is in use and which are free.
3. When you want to play a buffer, a sound, find a location using the bool lookup array. Send the buffer to that source.
4. Once every so often, every frame if you want, check the state of each source. Any state that reports a stopped state, set the bool flag in the array to 0 so you know that you can use it again.

That's all there is to it, good luck!

Share this post


Link to post
Share on other sites
Thanks for the replys. My understanding on how the sources worked was wrong. I thought that you made a source for every sound in the game and didnt even think that the sound cards would play a factor in it. Sorry I did exagerate a little bit on the amount of sources I tested. The max is 256 sources on my older labtop and im sure it worked because the check I showed in the source code above is correct and it broke on anything above 256. I tested the 256th source and it played the sound. Guess the sound card on it rocks :). But anyways thanks again.

Share this post


Link to post
Share on other sites
Not a problem, it's probabally not your fault on the misunderstanding about the sources. I know that all the tutorials I have read make it seem so. The oonly reason I know that's not the case is because I spent a few months writing an OpenAL library for our game. I learned all the hard way [lol]. There's a lot of stuff wrong with the avaliable resources on OpenAL [headshake]. Anyways, glad your stuff is working! Good luck with your game. [smile]

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!