Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

Latest commit

 

History

History
27 lines (19 loc) · 1022 Bytes

File metadata and controls

27 lines (19 loc) · 1022 Bytes
id title brief
EEEF63AF-44A6-4F84-82DD-CAA44CACAD39
Audio in CocosSharp
How to play sound and music in CocosSharp

Recipe

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:

CCAudioEngine.SharedEngine.PlayEffect (filename:"Electricity");

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.