Why does cocos2d-x crash after playing background music?

Datetime:2016-08-23 04:30:42         Topic: Cocos2d-X  IOS Development          Share        Original >>
Here to See The Original Article!!!

I call the following function once at the start of my game:


My music file is in car format. The game starts normally, and the music plays without problem. But the moment the track completes playing, cocos2d-x crashes.

The crash points to the following assembly line of code on Thread 26:

->  0x4650909 <+0>:   pushl  %ebp

I don’t know how to debug this, because I can’t step through the code (since the crash happens when the track finishes playing). It seems like some kind of bug. Any ideas how to solve this ?

EDIT: If I don’t play any music, my game never crashes. The only line of code that is ever called (for music), is the above, and it is called only once.

EDIT: The caf file was created using the following command:

afconvert -f caff -d LEI16@22050 yourInput.mp3 yourOutput.caf


Put your ads here, just $200 per month.