No Sound?

So I finally got my app to work on android devices. :slight_smile:

However, I get no sound on those devices…. I believe I copied all the required files from the test and HelloWorld examples. I have successfully built the libcocosdenshion.so and it gets placed in the armeabi successfully. My .java file has the following libraries linked, and it doesnt complain about an errors…

System.loadLibrary(“box2d”);
System.loadLibrary(“cocosdenshion”);
System.loadLibrary(“cocos2d”);
System.loadLibrary(“game”);

I am using the same code between iOS and Android, and the iOS sound works perfectly. I am currently using cocos2d-x version 1.0.0… Suggestions as to where I am going wrong?

Hello

Maybe you should see an error in the DDMS perpersctive of your eclipse when you runn the apps, in that case, are your sound file in an appropriate format that your android device can read as well ?

knd regards
david

Thanks for the info. I am VERY new to android development, and very unfamiliar with Eclipse. I wasnt even aware that the view you suggested existed until just now. Apparently I am doing something wrong since I see this about 100 times in my log.

09-08 17:13:00.358: ERROR/Cocos2dxSound(216): error: This file can not be opened as a file descriptor; it is probably compressed
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at android.content.res.AssetManager.openAssetFd(Native Method)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at android.content.res.AssetManager.openFd(AssetManager.java:314)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at org.cocos2dx.lib.Cocos2dxSound.createSoundIdFromAsset(Cocos2dxSound.java:143)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at org.cocos2dx.lib.Cocos2dxSound.preloadEffect(Cocos2dxSound.java:49)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at org.cocos2dx.lib.Cocos2dxActivity.preloadEffect(Cocos2dxActivity.java:169)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at org.cocos2dx.lib.Cocos2dxRenderer.nativeInit(Native Method)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at org.cocos2dx.lib.Cocos2dxRenderer.onSurfaceCreated(Cocos2dxRenderer.java:15)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1112)
09-08 17:13:00.358: ERROR/Cocos2dxSound(216): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:975)

I am going to assume that compressed .caf files are not supported on android? If that is a correct assumption, what format is supported / should I use.

hi,

no worries,wav ,mp3,mod is fine for me.if i didnt list all supported sound ,but if you look in the sample provided in the ndk (native-audio) you will see a couple of different format.
the test case provided by the excellent team of coco2d-x can help as well

Kind regards
david

What’s the format of your sound?
Does any resource is a .zip file? In android, it can not accept this kind of file as a resource.

error: This file can not be opened as a file descriptor; it is probably compressed
This error has said that, some resource is a compressed file.

.caf in compressed mono format converted with the afconvert tool for iOS. Is that supported? Also, nothing in .zip format.

I have not tested this format on android. But from your experience, it seems it is not supported.
So I suggest you run with other format, such as ogg.

hi,any solution till now?
i am trying to use **.raw format
**.ogg is working. but, it’s very fast