[back to index]

Library Reference (v 0.11.0)

Music

For playing music files.
Music.play(songname:String, ?offsettime:Float = 0.0, ?fadeintime:Float = 0, ?loop:Bool = true, ?panning:Float = 0)
Plays a song from data/sounds/ folder. Optionally set a startpoint (where 1.0 is 1 seconds into the song), a fade in time (0 means start immediately, 1.0 means fade in for one second), whether or not to loop, and a panning value (between -1 and +1 for left to right).
Music.stop(?fadeouttime:Float = 0)
Stop the currently playing song. Optionally set a fade out time (0 means stop immediately, 1.0 means fade out for one second)
Music.currentsong:String
A string containing the currently playing song. Blank if nothing is playing. You can check is a song is finished by checking if currentsong == "". Setting this value is the same as calling Music.play() with the default parameter values.
Music.currentposition:Float
A float, telling us how far into the currently playing song we are. 2.5 means two and half seconds in, for example. Setting this value allows you to change the current position in the song.
Music.crossfade:Float
Defaults to 0. Sets a crossfade value when changing songs. A value of 1.0 means crossfade between two songs for 1 second.