[Openal] ALC - vaporware?
Ed Phillips
ed at UDel.Edu
Fri Feb 29 08:14:41 PST 2008
Hey,
On Fri, 29 Feb 2008, Ed wrote:
> Are there any working implementations of the ALC* functions;
> particularly, is there any implementation out there that supports
> multiple contexts properly?
>
> Let me explain where I'm coming from:
>
> I spent over 9 hours yesterday trying to stop the reference
> implementation on Linux from segfaulting when more than one context is
> in play. Ignoring the fact that there are several straightforward bugs
> in the code (sure, I can patch it on my machine, but what about my
> users' machines?) it appears multiple context use was virtually never
> tested in this implementation. The only solution is to call absolutely
> as few ALC* calls as possible, because any one of them can corrupt the
> library's poorly maintained internal structures. The test program for
> the RI must've looked something like:
>
> dev = alcOpenDevice(NULL)
> ctx = alcCreateContext(dev,NULL)
> alcMakeContextCurrent(ctx)
> ...
> alcDestroyContext(ctx)
> alcCloseDevice(dev)
>
> Deviate from this exact sequence of calls and you'll see race
> condiitions, segfaults in the alsa mixer, segfaults in its own code,
> and no sound will play anyway. (The fix for anyone that cares and
> wants to support linux is to pull AL_RENDERER, AL_VENDOR and check
> that vendor is "OpenAL Community" (why oh why does openal-soft have
> the same vendor as its evil predecessor) and that renderer isn't
> "OpenAL-soft". If you get the linux ri, set the "we're in trouble"
> flag and never call any alc functions again until you exit.
FWIW...
Nitpick... you can call alcProcessContext() - not that it does anything
useful. You can't call alcSuspendContext() or you get no sound on Linux.
Both seem to work okay on Windows, although I'm not sure if they "do
anything" there either.
The game code I was working with wouldn't work on Linux but worked fine on
Windows. I wasted many, many hours before I accidentally got things
working when I simply commented out the alcSuspendContext() call because I
was thinking to myself, "Why the heck is this even needed?".
For OpenAL on Linux, in general, you will need to compile it yourself, and
fix it so it works correctly for your app... and include it with your app
somehow. Trusting the one that is installed on the user's system is
unfortunately just going to lead to more "headaches" since most
distributions aren't even using the current "OpenAL-Sample" code but some
way-old version that they've been including for years.
Ed
Ed Phillips <ed at udel.edu> University of Delaware (302) 831-6082
Systems Programmer IV, Network and Systems Services
More information about the Openal
mailing list