[Openal] multiple contexts

Peter Moore pmoore at umn.edu
Thu Apr 27 14:59:17 PDT 2006


Does anyone know of good example code that uses multiple contexts  
(and works)? Is there any known issues with playing sources on two  
contexts at the same time (each source belonging to only one context  
of course)? For example, shouldn't the following pseudocode work?

device = alcOpenDevice(0);
alGenBuffers(1, &buffer);
//Fill buffer with data

context1 = alcCreateContext(device, 0);
alcMakeContextCurrent(context1);
alGenSources(1, &source1);
alSourcei(source1, AL_LOOPING, AL_TRUE);
alSourcei(source1, AL_BUFFER, buffer);
alSourcePlay(source1);


context2 = alcCreateContext(device, 0);
alcMakeContextCurrent(context2);
alGenSources(1, &source2);
alSourcei(source2, AL_BUFFER, buffer);
alSourcei(source2, AL_LOOPING, AL_TRUE);
alSourcePlay(source2);

...etc...

Whenever I try to play the second sound source the application hangs  
(at least on Windows).

-Peter


More information about the Openal mailing list