Hi All,
I'm using ObjectAL to play sounds using both OALSimpleAudio for some files, and some using OALAudioFile with a source and buffer. This all works great , but once in a rare occasion both OALSimpleAudio and OALAudioFile files will not play any sounds. It seems to happen if I minimize the app, and then open it. I haven't seen it happen when the app is first loaded.
This happens while testing on an actual iPad2 device with iOS 6.0, without being connected to the Mac/Xcode.
It seems similar to an issue I've seen a number of posts for about CocosDension. I'm not using CocosDension in the app at all, and no references to it.
I did manage to narrow down where the issue is, and a reliable way to repeat the problem.
1) Run my app, even using the debugger with an actual iPad, and then minimize the app. All works fine.
2) With my app minimized, open another audio app such as "AudioMemos" ( random free audio app I downloaded )
3) Now minimize "AudioMemos" and open my app again. All looks OK and no
errors. But if I try to play one sound even just using OALSimpleAudio, I
get no sound and the following errors from ALSource.m:
OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
MyApp[9515:907] OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
I get the above errors 7 times in a row for each time I try to play one sound.
If I use the purgesharedinstance I can get the audio to come back when the app enters foreground, but I get a lot of error messages during the process, and it sometimes breaks the recorder I have in my app. So it's not a solution, but maybe a clue.
When I trace it down, it seems to be something with the code in ALSource.m as below.
- (bool) interrupted
{
return NO; // comes here when app back from minimized
}
- (void) setInterrupted:(bool) value
{
#pragma unused(value)
// Suspending on interrupt fails in iOS 6+ and doesn't seem to be needed anyway
}
- (bool) suspended
{
return suspendHandler.suspended;
}
- (void) setSuspended:(bool) value
{
if(value)
{
shadowState = self.state;
if(AL_PLAYING == shadowState)
{
[ALWrapper sourcePause:sourceId];
}
}
else
{
// The shadow state holds the state we had when suspending.
if(AL_PLAYING == shadowState)
{
// Because Apple's OpenAL implementation can't stack commands (it defers processing
// to a later sequence point), we have to delay resuming playback.
abortPlaybackResume = NO;
[self performSelector:@selector(delayedResumePlayback) withObject:nil afterDelay:0.03];
}
}
}
- (void) delayedResumePlayback
{
if(!abortPlaybackResume)
{
[ALWrapper sourcePlay:sourceId];
}
}
17:28:25.189 -[CCDirector init] : cocos2d: cocos2d v1.1.0-RC0
17:28:25.195 -[CCDirector init] : cocos2d: Using Director Type:CCDirectorDisplayLink
17:28:26.503 -[CCConfiguration init] : cocos2d: OS version: 6.0 (0x0x6000000)
17:28:26.514 -[CCConfiguration init] : cocos2d: GL_VENDOR: Imagination Technologies
17:28:26.516 -[CCConfiguration init] : cocos2d: GL_RENDERER: PowerVR SGX 543
17:28:26.518 -[CCConfiguration init] : cocos2d: GL_VERSION: OpenGL ES-CM 1.1 IMGSGX543-73.16
17:28:26.520 -[CCConfiguration init] : cocos2d: GL_MAX_TEXTURE_SIZE: 4096
17:28:26.522 -[CCConfiguration init] : cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16
17:28:26.523 -[CCConfiguration init] : cocos2d: GL_MAX_SAMPLES: 4
17:28:26.525 -[CCConfiguration init] : cocos2d: GL supports PVRTC: YES
17:28:26.526 -[CCConfiguration init] : cocos2d: GL supports BGRA8888 textures: YES
17:28:26.528 -[CCConfiguration init] : cocos2d: GL supports NPOT textures: YES
17:28:26.529 -[CCConfiguration init] : cocos2d: GL supports discard_framebuffer: YES
17:28:26.531 -[CCConfiguration init] : cocos2d: compiled with NPOT support: NO
17:28:26.532 -[CCConfiguration init] : cocos2d: compiled with VBO support in TextureAtlas : YES
17:28:26.533 -[CCConfiguration init] : cocos2d: compiled with Affine Matrix transformation in CCNode : YES
17:28:26.535 -[CCConfiguration init] : cocos2d: compiled with Profiling Support: NO
17:28:26.994 -[AppDelegate applicationDidFinishLaunching:] : Retina Display Not supported
17:28:27.007 -[ES1Renderer resizeFromLayer:] : cocos2d: surface size: 1024x768
17:28:27.022 Memory Capacity of 14165 MiB with 5422 MiB Free memory available.
AudioStreamBasicDescription: 2 ch, 44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
17:28:27.728 -[CCDirectorDisplayLink startAnimation] : cocos2d: Frame interval: 1
17:28:27.733 record processing begin
17:28:28.004 record file path set up finished
17:28:28.329 recorder allocated assigned to path
17:28:28.352 Recording initiated
17:28:32.434 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_background.png
17:28:32.439 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_title.png
17:28:32.440 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_mics.png
17:28:40.117 -[CCDirectorDisplayLink startAnimation] : cocos2d: Frame interval: 15
17:29:05.758 record processing begin
17:29:05.867 record file path set up finished
17:29:05.878 recorder allocated assigned to path
17:29:06.078 Recording initiated
17:29:06.080 -[CCDirectorDisplayLink startAnimation] : cocos2d: Frame interval: 15
17:29:06.085 -[CCDirectorDisplayLink startAnimation] : cocos2d: Frame interval: 1
17:29:10.254 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:10.257 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.259 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:10.261 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.262 OAL Error: +[ALWrapper sourcef:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:10.264 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.266 OAL Error: +[ALWrapper sourcef:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:10.268 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.269 OAL Error: +[ALWrapper source3f:parameter:v1:v2:v3:]: Invalid Value (error code 0x0000a003)
17:29:10.270 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.272 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:10.273 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.275 OAL Error: +[ALWrapper sourcePlay:]: Invalid Value (error code 0x0000a003)
17:29:10.276 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:10.853 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_quickset_background.png
17:29:10.857 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_multi-task_rec-on.png
17:29:10.859 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_detailedset-active.png
17:29:10.861 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_instant_replay.png
17:29:10.863 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_repeat_button-off.png
17:29:10.865 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_savedrecordings-active.png
17:29:10.866 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_settings.png
17:29:10.868 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_quickset-active.png
17:29:10.870 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_instant_replay-active.png
17:29:10.872 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_record_light-off.png
17:29:10.874 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_detailedset.png
17:29:10.875 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_quickset-button.png
17:29:10.877 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_recording_savedrecordings.png
17:29:10.879 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V1_ear.png
17:29:10.880 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_repeat_button-on.png
17:29:10.882 -[CCTextureCache removeUnusedTextures] : cocos2d: CCTextureCache: removing unused texture: V2_multi-task_rec-off.png
17:29:12.627 OAL Error: +[ALWrapper genSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:12.629 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.631 OAL Error: +[ALWrapper getSourcef:parameter:]: Invalid Value (error code 0x0000a003)
17:29:12.633 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.730 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:12.732 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.734 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.736 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.737 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.739 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.742 OAL Error: +[ALWrapper sourcePlay:]: Invalid Value (error code 0x0000a003)
17:29:12.743 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.745 OAL Error: +[ALWrapper genSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:12.746 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.748 OAL Error: +[ALWrapper getSourcef:parameter:]: Invalid Value (error code 0x0000a003)
17:29:12.750 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.751 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:12.753 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.754 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.756 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.757 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.759 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.761 OAL Error: +[ALWrapper sourcePlay:]: Invalid Value (error code 0x0000a003)
17:29:12.762 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.764 OAL Error: +[ALWrapper genSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:12.765 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.767 OAL Error: +[ALWrapper getSourcef:parameter:]: Invalid Value (error code 0x0000a003)
17:29:12.768 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.770 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:12.771 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.773 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.774 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.776 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:12.777 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:12.779 OAL Error: +[ALWrapper sourcePlay:]: Invalid Value (error code 0x0000a003)
17:29:12.781 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.898 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:20.901 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.904 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:20.905 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.907 OAL Error: +[ALWrapper deleteSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:20.908 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.910 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:20.911 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.913 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:20.916 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.917 OAL Error: +[ALWrapper deleteSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:20.919 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.920 OAL Error: +[ALWrapper sourceStop:]: Invalid Value (error code 0x0000a003)
17:29:20.922 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.923 OAL Error: +[ALWrapper sourcei:parameter:value:]: Invalid Value (error code 0x0000a003)
17:29:20.925 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.
17:29:20.926 OAL Error: +[ALWrapper deleteSources:numSources:]: Invalid Operation (error code 0x0000a004)
17:29:20.929 OAL Warning: -[OALAudioSession onAudioError:]: Received audio error notification, but session is suspended. Doing nothing.