SoundLiteAS3

author:
Rajavanya Subramaniyan
description:
Add all sound related functionality within minutes to your game.
lastupdate:
2013-09-16
tag:
sound, music, bg, sfx, muting, fading, soundgroups
homepage:
https://github.com/quakeboy/SoundLiteAS3
author-website:
http://www.rajavanya.com

Why SoundLite?

SoundLiteAS3 is the result of thinking why does a game developer need to code certain game sound related tasks again and again, even though they are simple.

For your game it allows very quick integration of features like

Limitations

How to use?

Notes

Example usage - simple

//first declare the Embeds
[Embed(source="../res/loop.mp3")]
public static var bg_loop:Class;
 
[Embed(source="../res/sfx.mp3")]
public static var sfx_1:Class;
 
//create MSound objects
private var sfx1:MSound = new MSound(new sfx_1());
private var bgloop:MSound = new MSound(new bg_loop(), 1000, 0.4);
 
//init MBG and MSFX, preferably in AS3 main class constructor
MBG.init();
MSFX.init();
 
//use the methods on events as needed
MSFX.play(sfx1);
MBG.play(bgloop);   //fadesIn, when done through MBG
MBG.stop();         //fadesOut, when done through MBG
MBG.toggleMute();   //stop and starts last sound automatically when done on MBG
MSFX.setMute(true);

Example usage - sound groups

//gem0 to gem4 are MSound objects
private var allgems:Array = new Array(gem0, gem1, gem2, gem3, gem4);
private var gems_random:MSoundGroup = new MSoundGroup(allgems);
private var gems_sequential:MSoundGroup = new MSoundGroup(allgems, MSoundGroup.MODE_SEQUENTIAL);

//to play
MSFX.play(gems_random); //or
MSFX.play(gems_sequential);

Changelog

dfsdaf asdfsdafsafad的法师的Boldsdaf Textd 打发打发士大夫对方啊对方