How to play .wav .mp3 file Sound in Coco2d-x ?
Solution :
Solution :
CocosDenshion:: SimpleAudioEngine:: sharedEngine()->playEffect(" hitWall.wav");
Note:
You can't play long clips with playEffect. You have to use playBackgroundMusic for those effects. You also need to preload the effects or tracks if you want the playback to be instantaneous or quick. The file formats also need to be acceptable by CocosDenshion. Look at the header file to understand what formats are accepted and what aren't. Lastly look at the CocosDenshionTest.cpp file if you want to see usage patterns / sample code (how to give the location of a resource file, set the volume etc)
0 comments:
Post a Comment