Jump to content
  • Advertisement
Sign in to follow this  
d000hg

[OpenAL]You can't start multiple sources at the same time?!

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

	for(i=0;i<5/;++i)
	{
		add_sound_object( i,0,0);
		//Sleep(100);
	}
After struggling for some time I've figured out what's wrong with my AL implementation, and it is very suprising. In the code above, add_sound_object loads samples for the specified sound type (if required) and queues them against the first unused source in a list. The code shown will result in errors in alGenBuffer and alQueueSource - however if I uncomment the Sleep call it works fine! I'm not using any threads so nothing in my code will be affected by this change - I can only assume that trying to queue/load too many things at the same instant knackers AL's internal threads or something... can anyone corroborate?

Share this post


Link to post
Share on other sites
Advertisement
When you say it works when Sleep() is called, does that mean the errors go away or the sound plays or both? I have not had any problems loading and playing multiple buffers.

Could you post some minimal source that replicates your problem? It would also be helpful to see what's in your add_sound_object() function.

What are the size and count of your buffers and how many sources play at once? I don't know what your computer specs are but if it is really slow((less)400Mhz) that may be a problem.

It's very strange that alGenBuffer() would generate an INVALID_NAME error. Make sure you log the value of alGetError() after every OpenAL call.

Oh, and from your other OpenAL thread, playing 7-8 source at once shouldn't be a problem for a reasonable computer.

Share this post


Link to post
Share on other sites
The source is quite complex...

I'm playing maybe 5 sources at the same instant, each being queued with 2/3 buffers. With Sleep() enabled, there are no errors and the sounds play. Without it, some of the sources get errors (not all).
The PC is 750MHz.

Do I need to use a Mutex/Ctitical Section with AL if my app is single-threaded - the original source did this but it seems un-needed.

Share this post


Link to post
Share on other sites
I don't think you need any of those things. You must be working with some pretty wierd platform/source:) I'll share my audio code. It streams .oggs and play wave files. Maybe it'll help somehow.
openal_audio.zip
Good Luck

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!