[Openal] multithreaded multidevice app problems
Chris Robinson
chris.kcat at gmail.com
Thu Apr 26 20:31:15 PDT 2012
On Thursday, April 26, 2012 10:19:26 PM Bruce Clay wrote:
> In
> searching the web I found messages that said a process can only have one
> context. Does that apply to the whole process or should a thread acting
> with it's own instance of OpenAL and it's own headset work?
Hi.
What do you mean by an "instance of OpenAL"? The one-active-context-per-
process restriction is based on the DLLs being called. If you're using the
same DLL but with multiple devices (whether that's OpenAL32.dll, wrap_oal.dll,
or whatever else), there can still only be one active context per process. If
you're somehow loading multiple separate DLLs (and not the same DLL multiple
times), then whichever DLL's functions you call is the one that will be
affected.
OpenAL Soft[1] has a cleaner way around this, though. It has a new-ish
extension called ALC_EXT_thread_local_context[2], which provides functions to
make a context active only on the calling thread, so each thread can have a
different context. You could create 4 devices for 4 separate headsets, 1
context from each device, and set each context as current on 4 separate
threads, then they'll all work independently.
[1] http://kcat.strangesoft.net/openal.html
[2] http://kcat.strangesoft.net/openal-extensions/EXT_thread_local_context.txt
Hope that helps. :)
More information about the Openal
mailing list