SimpleAudio playEffect() issue?

I have same problem.
I preload effects and one long sound stoped after few seconds…
can you give me some suggestions??
these error messages are occure when the sound stoped…
I use recent version of cocos2d-x

01-02 18:20:08.972: VERBOSE/AudioPolicyManager(75): stopOutput() output 1, stream 3, session 168
01-02 18:20:08.972: VERBOSE/AudioPolicyManager(75): getDeviceForStrategy() from cache strategy 0, device 2
01-02 18:20:08.972: VERBOSE/AudioPolicyManager(75): getNewDevice() selected device 2
01-02 18:20:08.972: VERBOSE/AudioPolicyManager(75): setOutputDevice() output 1 device 2 delayMs 94 force 0
01-02 18:20:08.972: VERBOSE/AudioPolicyManager(75): setOutputDevice() setting same device 2 or null device for output 1

01-03 11:01:46.241: INFO/Omap4ALSA(1301): Buffer size: 4096
01-03 11:01:46.241: INFO/Omap4ALSA(1301): Latency: 92879
01-03 11:01:46.312: INFO/Omap4ALSA(1301): Initialized ALSA PLAYBACK device ‘plughw:0,0’
01-03 11:02:14.655: DEBUG/dalvikvm(1655): GC_EXPLICIT freed 219K, 49 free 2895K/5575K, external 847K/1181K, paused 40ms
01-03 11:02:19.671: DEBUG/dalvikvm(2004): GC_EXPLICIT freed 78K, 52 free 2736K/5639K, external 847K/1181K, paused 37ms

01-03 17:52:57.296: ERROR/AudioCache(1301): Heap size overflow! req size: 1052672, max size: 1048576

Did you play many effects at a time?

nope. one background music and one effect are playing.
background music works fine but effect are cut

Could you paste the file?
I will test it on my g10.

I test on example “Cocos2dxSimpleGame” linked in this site, and same thing…
I changed “pew-pew-lei.wav” file to other long sound and the sound stopped.
pew-pew-lei.wav’s duration is 1 sechond. and changed one is 12 secondes… :frowning:
test device is galaxy tab.

I have the same issue.
I play an effect WAVE format. First time it works fine, and then it’s cut.
I have this problem on IOS 4.3, iPhone 4.

I fixed my problem, it was due to Transition between scenes. Now it’s working for me.

Does somebody have a trick to be sure that the sounds will be played ? And when they are played, to be sure that they will be played completely ? (not only few seconds…) II tested wav, caf, mp3: some of them works, some other do not work… I use SDK .10 and NDK r7b.

Thanks !

same issue, only can play effect 10sec on my tab 10.1
any idea can fix this problem?

cocos2d-x use SoundPool.
And soundpool has limitation of file bytes, 1048576 is limit.
When soundpool play ogg, mp3 format files, soundpool streams and uncompress files.
And uncompressed byte can’t over 1048576.

It’s cool, too.

Guys, you have solved my two problems at a snap.

So, what I need to do is reducing the sound file bytes ?

Do I need to change some codes on my project ?

just tested the SoundPool limit, FYI:
24kHz, mono, CBR for 20s mp3
12kHz, mono, CBR for 30s mp3

so anyone’s got the solution for this problem?

i’m facing with this problem as well, i both tried mp3 and ogg, my audio file shd b 10seconds long, but it’s played only 3-4 secs, even i preloaded it before playing it

Anyone please suggest me ideas to solve this problem please

Hi all, I am facing same issues. Has anybody got the solution for this issue.

Though I can play a .mp3 file by calling preloadEffect* early before callingplayEffect()*, myy file is 20 seconds long and it is only played for 14-15 seconds.

I think you can try the OpenSL version build.

Here is the reference URL : http://www.cocos2d-x.org/news/65

I am without luck to get it worked on my hTC, maybe you will. :slight_smile:

Simon Lin wrote:

I think you can try the OpenSL version build.
>
Here is the reference URL : http://www.cocos2d-x.org/news/65
>
I am without luck to get it worked on my hTC, maybe you will. :slight_smile:

hi Simon,

isn’t the OpenSL supposed to use with only the i9100?

Yeap, now it is only used on i9100.

i am using the galaxy tab 10.1 and 7.7 have same problem.
May be some effect is to large?
The effect is 80 to 150 kb.
Some effect can play done, and some effect can’t to play last 2-3 second.

I temporarily solved my problem by converting .mp3(I was using it previously) to .ogg file. If that is also not working one needs to low-down the bit rate of audio to 24kbps. This obviously will affect the audio quality but I had not other way.

The developers the library should provide an option as playBackgroundEffect is working. I know background is using MediaPlayer and playEffect is using SoundPool.

Sorry for revive this thread, but did really someone fix this problem?

Im using cocos2d-1.0.1-x-0.12.0 and experiment same problem of first time playing dont work.