For your second question, you can refer the comment of Cocos2dxSound.playEffect().
The comment is:
/*
* Someone reports that, it can not play effect for the
* first time. If you are lucky to meet it. There are two
* ways to resolve it.
* 1. Add some delay here. I don't know how long it is, so
* I don't add it here.
* 2. If you use 2.2(API level 8), you can call
* SoundPool.setOnLoadCompleteListener() to play the effect.
* Because the method is supported from 2.2, so I can't use
* it here.
*/
What is the version of cocos2d-x?
I have not preloaded more than one background music.
On android, you don’t need to preload background music, it is as quick as you play it without preloading.
But I will fix it if it was crashing by preloading more than one background music.
The code is ok.
You mean the code can not play effect for first time even it is preloaded before?
I have tested Cocos2denShionTest on g10, and it can play effect at the first time.
I used playEffect() to play a long effect mp3 file. It is about half minute long. And when I play it for the first time, I can hear nothing, and the second time, the first one or two second works, but after that the effect is gone.
I used 0.9.1. And this problem only occurs on android.
dear minggo :
i got some issue like this, my sound effect’s length is 1.3minutes, but when its played on android, its like play 10sec then stop automatically.
how can i solve this problem?
@minggo, yes, i already use the ogg format. the sound won’t play in 1st time, but when i play it in 2nd time, it play, but its play only 10sec. is this bugs?
@minggo, in asus transformer 101 / TF101, when i run cocos2dxsimplegame on that device, i doing multitouch and that app is crash. the message is “The application cocos2dxsimplegame(process.org,cocos2dx.cocos2dxSimpleGame) has stopped unexpectedly. Please try again” is that bugs?