[ Home ]

Library Documentation (v 0.13.0)

Sound

For playing sound effects.
Sound.load(soundname:String, adjustedvolumelevel:Float = 1.0)
Loads in a sound from data/sounds/ - either MP3,OGG or WAV, depending on platform. See "how to add assets.txt" in your data folder for more details. Optionally set a volume adjustement for the loaded sound (0.5 loads it in at half volume, for example.)
Sound.play(soundname:String, ?fadeintime:Float = 0, ?loop:Bool = false, ?volume:Float = 1.0, ?panning:Float = 0)
Plays a sound from data/sounds/ folder. Optionally set a fade in time (0 means start immediately, 1.0 means fade in for one second), whether or not to loop, a volume (1.0 is full), and a panning value (between -1 and +1 for left to right).
Sound.offset(soundname:String, ?offsettime:Float = 0.0)
Sets a startpoint for a soundfile (where 1.0 is 1 seconds into the sound effect or song) that's used the next time you play the sound or music file.
Sound.stop(soundname:String = "", ?fadeouttime:Float = 0)
If soundname is blank, stop all sound effects from playing. Otherwise, stop any sounds that match with the given soundname. Optionally set a fade out time (0 means stop immediately, 1.0 means fade out for one second)
Sound.length(soundname:String):Float
Gets the length of a given sound file in seconds. 1.5 means one and a half seconds long, for example.
Sound.mastervolume:Float
A float between 0 and 1 to set the volume of your application. Affects everything, music and sounds both.
Sound.typingsound:String
If set, play the named sound effect when the player types something in.