In iPhone how can I play ogg, caf audio file? I use CocosDenshion in cocos2d-2.1beta3-x-2.1.1.

It play .wav file ok.
How can I play
.ogg and *.caf?
Thank you.

What implementation are you using to play .wav files ?

I can confirm AVAudioPlayer can play .caf files. Reading a few threads here and there, it should also be able to play .ogg files.

I’m using CocosDenshion in cocos2d-2.1beta3-x-2.1.1.

.caf files should play alright on iOS, see http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Audio_formats_supported_by_CocosDenshion_on_different_platforms

If you have a problem, please post more informations : some snippet of code to replicate the problem, a precise description of the problem, some error logs …

I think its a bit of a pain that each platform requires different formats.

Are we supposed to wrap every call to play/preload a sound effect with a TargetPlatform check?

I’m using a .wav but that does not work (or sounds funny) on some android devices.

Does .ogg work on all android devices?
What about on windows, I assume you would need to have a ogg codec installed?

Afaik ogg currently does not work on windows. According to http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Audio_formats_supported_by_CocosDenshion_on_different_platforms ogg is supported on android. Personally I think that cocos2d-x needs some truly multiplatform solution for ogg support. There is a free public domain decoder for ogg writen in C http://www.nothings.org/stb_vorbis/ I did not use it but it looks promising. It would be great if it or something similar could be included in cocos2d-x and wrapped with some easy to use api.

What I have seen so far, the main difference in Cocos2d-x is the filenames (.ogg vs. .caf)

That seems pretty easy to get around, just loading the right sound effect name for the platform?

Is there a bigger issue at hand?

Yes you could use different formats for different platforms, but it would be much better if there was a format (preferably ogg because its free, uses quite good compression and its rather a standard nowadays) that works on all platforms out of the box.

I agree to Leszek Leszek.(It would be much better if there was a format (preferably ogg because its free, uses quite good compression and its rather a standard nowadays) that works on all platforms out of the box.)

ogg format won’t work on iPhone so I convert wav to caf.
I use shell command “afconvert f caffd ima4 filename” but result sound seem like lost quality.
What is best way convert to caf, not lost mush sound quality and compress like ogg?

try Avdshare Video Converter to convert any OGG to any model of iPhone, iPad, iPod, iTunes, Apple TV and other Apple products supported MP3 or other audio formats:https://www.avdshare.com/play-ogg-on-iphone