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

Started by
4 comments, last by Jack Sotac 18 years ago
	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?
Advertisement
Don't the errors give you any further details?
I get the error "Invalid Name" from alGenBuffer. This is just plain wierd...
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.
0xa0000000
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.
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
0xa0000000

This topic is closed to new replies.

Advertisement