[Openal] Create multiply contexts

Garin Hiebert garinh at cheesetoast.net
Mon Aug 7 08:01:00 PDT 2006


>  I got the latest code using the command 
> svn co http://www.openal.org/repos/openal/trunk 
> Could you Please tell whether I am using proper sources, Also if
> simultaneous Multiple Devices ever been tested using openAL.
>   
The wrapper code in Subversion and the version distributed by Creative 
restrict you to one context per device ("Generic Hardware" or "Generic 
Software").  If you create a second context on a device, you should get 
an error (a context error -- make sure you're looking for the right one) 
and a NULL context pointer for the second context.

In a case where you do manage to get two valid contexts (I think it can 
be done if you have successfully enumerated and opened two separate 
devices -- for instance a Sound Blaster Audigy and a motherboard-down 
solution), you want to use alcMakeContextCurrent to set the context 
before working on it.  An example:

void AudioSystem::Update()
{
    if (context1) {
       alcMakeContextCurrent(context1);
       [Context 1 operations]
    }

    if (context2) {
       alcMakeContextCurrent(context2);
       [Context 2 operations]
    }
}

This is not well-tested territory at the moment.  As I said earlier in 
my response, it was only a few weeks ago that I added 
multi-device/multi-context testing to the Creative test suite, and we're 
definitely seeing errors.  My impression at the moment is that the 
errors are contained to situations where the router is asked to open 
multiple contexts for the same device (which is allowed on Creative's 
native implementations) -- so the scenario above _should_ still work if 
you have multiple physical devices and at least one is native.

Hopefully my description makes some sense -- it's a complicated subject.

Garin



More information about the Openal mailing list