AudioEngine::play2d plays only a second or two from attached file. It plays mp3 well but it’s not a solution, because mp3 is a paid format. SimpleAudioEngine is also a bad choice, because it’s impossible to set volume level on Win32. Is there any workaround or fix? It seems that audio playback in cocos2d-x isn’t working well on Win32. Maybe I should use some 3rd party lib for sound playback?
Have you tried the newer experimental::AudioEngine?
I would just use MP3 until you find a fix for large ogg files or the engine team does. Unless you’re not close to release. MP3 is not free, technically, but I believe all the supported platforms have already paid for the license to play (Windows/Apple/Google/FMod).
I’m talking exactly about experimental::AudioEngine. As per http://mp3licensing.com/royalty/games.html mp3 is not free if more than 5000 copies of the game are distributed.
IANAL, but I think that is only if you include the decoder in your app though? If you’re concerned, then you’ll have to file a github issue and wait for the team to fix it or fix the issue yourself if your pressed for time.
Sorry to reply to such an old post, but it seems this is still not fixed. Small ogg files are playing ok, but not large (music-sized) files. Anybody know if there’s a workaround that doesn’t involve completely replacing SimpleAudioEngine or AudioEngine?
Dug around the code a bit and found a workaround:
Changing the cache size AudioCache.cpp allows the audio to render:
#define PCMDATA_CACHEMAXSIZE 2621440
It’s probably not ok to ship a game with this, so I’m not sure what to do now… try to fix this or start over with SDL_Mixer or something similar that would be less bug prone.
Cool =)
I’m mostly worried that load times will take much longer now. And hopefully there’s no other problem with this experimental code (such as memory leaks, etc).
I just wanted to confirm that this bug is not fixed in v3.1.2 or latest from git (as of 7/8/2016). The bug report is closed though - hopefully it can be reopened and addressed: