Sign in to follow this  
d000hg

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

Recommended Posts

d000hg    1199
	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
Jack Sotac    528
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
d000hg    1199
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

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