Audio in CocosSharp
- PDF for offline use
Let us know how you feel about this
How to play sound and music in CocosSharp
Audio can be played using the
CCAudioEngine class. Background music is streamed from device, and is typically represented by a compressed file format. Sound effects are played from uncompressed files.
The following code shows how to play background music:
CCAudioEngine.SharedEngine.PlayBackgroundMusic ( filename:"FruityFalls", loop:false);
The following code shows how to play a sound effect:
CocosSharp supports the MonoGame content pipeline types (.xnb files) for music and sound effects. For information on using the content pipeline, see the CocosSharp Content Pipeline Guide.
For a full example on playing audio, see the CCAudioEngine sample.