4

I have a bad performance problem with OpenAL in my iPhone game. My game runs smoothly with 60fps but when I initialize OpenAL the game begins to jerk. This is my initialisation code:

    ALCdevice* device = alcOpenDevice(NULL);
    ALCcontext *context;

    if(device) {
        context = alcCreateContext(device, NULL);
        alcMakeContextCurrent(context);
    }

I don't create any OpenAL Sources nor load/play any sounds. The jittering (the game jerks all the time) is caused by the initializing of OpenAL. The XCode instruments are saying that the game runs with stable 60fps yet it's obviously jittering (when I don't run the code above the game runs smoothly).

This also doesn't happen on an old iPod Touch 2G with iOS 3.1.3. On all my other devices with iOS 4 the jittering happens, which is also crazy. I also tried to put the OpenAL stuff in a separate thread but it doesn't help.

Has anybody noticed a similar behaviour?

RJFalconer
  • 10,890
  • 5
  • 51
  • 66
Andreas Illiger
  • 263
  • 1
  • 4
  • I've edited your post to show the most likely definition of "device" and "context"; please confirm you are doing something similar. – RJFalconer Feb 19 '14 at 12:29

1 Answers1

0

Try calling alcGetError() after context set up to ensure it succeeded.

Is this failing on the simulator or on an actual phone?

Are you doing anything with sound after the code you posted? In the code you posted if alcOpenDevice fails then you won't have a context, yet you don't return either.

RJFalconer
  • 10,890
  • 5
  • 51
  • 66