hi guys:
i use this method to play music, i can play every normal music, but when i close my game, my game crash…
the bugs tell it’s swapbuffer problem… does anybody know it, thanks ~
hi guys:
i use this method to play music, i can play every normal music, but when i close my game, my game crash…
the bugs tell it’s swapbuffer problem… does anybody know it, thanks ~
You have to be more specific! Witch device are you trying ? Are you using the simulator ? Is it on Android ? iOS ? Happens on both ? Are you using MP3 ? OGG ? It crashes without log ? Are you pausing you background music when going to background ? Are you truly closing your game ?
Give us more clues and maybe we can help you out!
Hi joe: I am using ipod && ipad to test my game, and this 2 device are all crash when i close game.
if I do not use SimpleAudioEngine::sharedEngine()~~>playBackgroundMusic, everything is fine…
the music is MP3.
I run a code example found from the ray website, introduced how to use cocos2d-x.
game is not crash, but can not hear backgroundmusic sound.
here is the link: http://www.raywenderlich.com/11338/cocos2d-x-for-ios-and-android-space-game
here is my detail bug info:
~~ (void) swapBuffers {
// IMPORTANT:
// - preconditions
// > context_ MUST be the OpenGL context> renderbuffer_ must be the the RENDER BUFFER
//
#ifdef __IPHONE_4_0
if (multiSampling_) {
/* Resolve from msaaFramebuffer to resolveFramebuffer */
//glDisable(GL_SCISSOR_TEST);
glBindFramebufferOES(GL_READ_FRAMEBUFFER_APPLE, [renderer_ msaaFrameBuffer]);
glBindFramebufferOES(GL_DRAW_FRAMEBUFFER_APPLE, [renderer_ defaultFrameBuffer]);
glResolveMultisampleFramebufferAPPLE();
}
if( discardFramebufferSupported_) {
if (multiSampling_) {
if (depthFormat_) {
GLenum attachments[] = {GL_COLOR_ATTACHMENT0_OES, GL_DEPTH_ATTACHMENT_OES};
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 2, attachments);
}
else {
GLenum attachments[] = {GL_COLOR_ATTACHMENT0_OES};
glDiscardFramebufferEXT(GL_READ_FRAMEBUFFER_APPLE, 1, attachments);
}
glBindRenderbufferOES(GL_RENDERBUFFER_OES, [renderer_ colorRenderBuffer]);
}
// not MSAA
else if (depthFormat_ ) {
GLenum attachments[] = { GL_DEPTH_ATTACHMENT_OES};
glDiscardFramebufferEXT(GL_FRAMEBUFFER_OES, 1, attachments);
}
}
#endif // __IPHONE_4_0
if(![context_ presentRenderbuffer:GL_RENDERBUFFER_OES]) {
// CCLOG (@“cocos2d: Failed to swap renderbuffer in %s\n”, FUNCTION);
}
#if COCOS2D_DEBUG
CHECK_GL_ERROR();
#endif
// We can safely re-bind the framebuffer here, since this will be the
// 1st instruction of the new main loop
if( multiSampling_ )
glBindFramebufferOES(GL_FRAMEBUFFER_OES, [renderer_ msaaFrameBuffer]);
bug stop here:
if(![context_ presentRenderbuffer:GL_RENDERBUFFER_OES])
{
// CCLOG (@“cocos2d: Failed to swap renderbuffer in %s\n”, FUNCTION);
}
Hi tony, have you resolve the problem, i met it too.
tony come wrote:
hi guys:
i use this method to play music, i can play every normal music, but when i close my game, my game crash…
>
the bugs tell it’s swapbuffer problem… does anybody know it, thanks ~
Do you use SimpleAudioEngine::sharedEngine()->end() when quitting your game?
Hi redaur, yes, I called SimpleAudioEngine::sharedEngine()->end() in SubLayer::onExit, SubLayer extends CCLayer.
redaur redaur wrote:
Do you use SimpleAudioEngine::sharedEngine()->end() when quitting your game?
This sounds similar to this: http://www.cocos2d-iphone.org/forum/topic/7163
I also got an error when quitting my app after adding audio using CocosDenshion.
I got the following output:
libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
0x3114d094: trap
0x3114d096: nop
After adding the stopAnimation and startAnimation calls like in the last post of the thread I linked to my app no longer crashes.