11-21-2012 03:25 PM
OpenAL works fine on BB10, but suspending the OpenAL thread seems not to do anything, I'm doing the following:
ALCcontext* context = alcGetCurrentContext();
if(context != NULL) {
alcSuspendContext(context);
alcMakeContextCurrent(NULL);
}
Is there anything else that needs to be done in order for this to work? I want to pause OpenAL when the window is inactive.
11-22-2012 06:17 AM
Here is what I do when my apps enter into background...
ALContext is my OpenAl context that I keep in memory
// enter background
alcMakeContextCurrent(NULL);
alcProcessContext(ALContext);
// exit background
alcMakeContextCurrent(ALContext);
alcProcessContext(ALContext);
11-22-2012 08:41 AM
So that just seems to work? alcProcessContext is meant to be used to initiate a context. Is alcSuspendContext no-op for you as well?
11-22-2012 08:45 AM
I don't use alcSuspendContext.
BTW, I'm using my OpenAL engine on PC/Mac/iOS/BB10 and this seems to work everywhere. I can't remember where I find this, but I didn't make it myself, so this is probably th recommand way to do it.
11-22-2012 09:43 AM
Does this work on iOS? I use alcSuspendContext on iOS and Android. Anyways will look into this, will get back to this thread if it does not work.
11-22-2012 09:45 AM
> Does this work on iOS?
I am using the exact same code on all these platforms for OpenAL.
11-22-2012 10:36 AM
It doesn't work for me. If I have a looping source, it just continues to loop. This is what I'm doing:
ALCcontext* context = alcGetCurrentContext();
if(context != NULL) {
alcMakeContextCurrent(NULL);
alcProcessContext(context);
}
If you set every sound source to looping and run this code, does it stop the sounds and suspend the openal thread?
11-22-2012 11:05 AM
It does work for me for everything.
The only difference I have with you is that I am storing the context at creation time (you call context = alcGetCurrentContext(); instead).
I've packed the Audio files from my engine, so you might to see what the difference between you and me:
http://www.ovogame.com/Misc/VDAudio.zip
JC
11-22-2012 11:42 AM
Thanks JC, I will have a look at it.
This is how I'm creating a context:
ALboolean result = alutInit(NULL, NULL);
alutInit should run the same lines as you do in OpenSys, the important one being alcMakeContextCurrent(ALContext, because that is the ptr that alcGetCurrentContext() returns.
Strange, will create the context without alut and see if there is any difference.
11-22-2012 12:59 PM
I'm doing the same thing as you and it still does not work. Are you sure that you have tried it with a looping sound source?
Johan