Sound effect not playing in loop

Hey im porting my game from windows to android and im using the cocos2d-x-2.1.5 version for android. Im having this problem that my sound effect which plays in a loop in windows isnt playing at all on android.
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(“running.wav”, true);
However it plays fine when i just do
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(“running.wav”);
how do i fix this i want it to run in an infinite loop but not as my background music

Turns out WAV files are poorly supported in Android.

I would suggest you convert to MP3, or OGG for SFX.

thanks ok i will

i converted it to mp3 its still not working :confused:

is there any other way to make it loop?

Muhammad Saad wrote:

i converted it to mp3 its still not working :confused:

but now it does play on Android? just not looping? Details!

its still the same problem. when i use
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(“running.mp3”, true);
it doesnt play at all. When i do
CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect(“running.mp3”);
then it plays fine but just once
i even tried .ogg

Just out of curiosity, what Android device are you testing on?

I have a list of device-specific SoundPool bugs that I can check.

im testing on htc desire hd and samsung galaxy tab 2. same problem on both

I also have the same problem .
HTC G17
mp3 , wav , ogg playEffect playMusic All do not work on android
on windows mp3 wav work fine ,ogg do not work

Android 4.3 can’t loop sounds. Are you running Android 4.3?

Cory Trese wrote:

Android 4.3 can’t loop sounds. Are you running Android 4.3?

Did you mean it is a bug of Android 4.3?

I use HTC G17 and the cocosdenshion test sample of the TestCPP, the wav , ogg playEffect can work on this phone which system version is 4.0.3,and ogg can’t work in windows.

Here is the Android 4.3 report of SoundPool being unable to loop sounds:

https://code.google.com/p/android/issues/detail?id=58113

OGG doesn’t work on windows, agreed:

http://www.cocos2d-x.org/wiki/Audio_formats_supported_by_CocosDenshion_on_different_platforms

@Cory Trese
Thanks for your link. It is a bad news.

so now what? no way to solve this at all?

So the only workaround would be to patch SimpleAudioEngineOpenSL.cpp to detect 4.3 and then have a timed/interrupt routine that checked for the “looped” sample ending (use “s_pOpenSL->getEffectState(id)” maybe) and play it again to simulate the loop?

Wouldn’t be perfect with the odd crackle and microsecond gap between plays, but what else?

To be honest, Android doesn’t support OpenSL well. So i don’t think it is a good way.
How about support playing more than one background music, then can use playBackgroundMusic on Android 4.3, or use media player instead of sound pool on Android 4.3?

#2913 is created for it.
Any body knows the market share of Android 4.3?

#2913 is created for it.
Any body knows the market share of Android 4.3?